package gui;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JButton;

import java.awt.BorderLayout;

import javax.swing.InputVerifier;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.JSlider;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EtchedBorder;
import javax.swing.border.LineBorder;

import java.awt.Color;

import javax.swing.JCheckBox;

import optimizers.commons.Parameter;
import optimizers.commons.RunConfig;
import optimizers.ganeat.Constants;
import optimizers.ganeat.Individual;

import javax.swing.event.ChangeListener;
import javax.swing.event.ChangeEvent;

import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;

import javax.swing.JComboBox;

import java.awt.event.ItemListener;
import java.awt.event.ItemEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Properties;
import java.util.Scanner;
import java.awt.CardLayout;

import cadtoolbox.optimizer.FitnessEvaluation;

import com.sl.connector.ConnectorContainer;
import com.sl.connector.JConnector;
import com.sl.line.ConnectLine;

import common.RunStarter;
import common.Static;
import fitness.Fitness;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

import javax.swing.JScrollPane;

import java.awt.Dimension;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;

import javax.swing.border.EmptyBorder;
import javax.swing.JProgressBar;
import javax.swing.JTextArea;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

import util.MyUtil;
import visualization.GraphDisplayer;

import javax.swing.DefaultComboBoxModel;

public class Main {

	public static String NUMBER_OF_RUNS = "NUMBER_OF_RUNS";
	public static String POP_SIZE = "POP_SIZE";
	public static String MAX_GENERATION = "MAX_GENERATION";
	public static String TOURNAMENT_SIZE = "TOURNAMENT_SIZE";
	public static String PROB_MUTATION_ONLY = "PROB_MUTATION_ONLY";
	public static String PROB_INTERSPECIES_MATING = "PROB_INTERSPECIES_MATING";
	public static String PROB_MUTATION_AFTER_CROSSOVER = "PROB_MUTATION_AFTER_CROSSOVER";
	public static String PROB_PARAM_MUTATION = "PROB_PARAM_MUTATION";
	public static String PROB_GENE_MUTATION = "PROB_GENE_MUTATION";
	public static String PROB_RANDOM_PARAM_MUTATE = "PROB_RANDOM_PARAM_MUTATE";
	public static String PROB_CONNECTION_DISABLING = "PROB_CONNECTION_DISABLING";
	public static String PARAM_MUTATION_GAUSSIAN_FACTOR1 = "PARAM_MUTATION_GAUSSIAN_FACTOR1";
	public static String PARAM_MUTATION_GAUSSIAN_FACTOR2 = "PARAM_MUTATION_GAUSSIAN_FACTOR2";
	public static String PROB_ADD_NODE_MUTATION = "PROB_ADD_NODE_MUTATION";
	public static String PROB_ADD_ACTIVATION = "PROB_ADD_ACTIVATION";
	public static String PROB_ADD_DOUBLE_INHIBITION = "PROB_ADD_DOUBLE_INHIBITION";
	public static String SPECIATION_COEFFICIENT1 = "SPECIATION_COEFFICIENT1";
	public static String SPECIATION_COEFFICIENT2 = "SPECIATION_COEFFICIENT2";
	public static String SPECIATION_COEFFICIENT3 = "SPECIATION_COEFFICIENT3";
	public static String SPECIATION_THRESHOLD = "SPECIATION_THRESHOLD";
	public static String TARGET_NUMBER_OF_SPECIES = "TARGET_NUMBER_OF_SPECIES";
	public static String SPECIATION_THRESHOLD_MIN = "SPECIATION_THRESHOLD_MIN";
	public static String SPECIATION_THRESHOLD_MOD = "SPECIATION_THRESHOLD_MOD";
	public static String REMOVE_NON_IMPROVING_SPECIES = "REMOVE_NON_IMPROVING_SPECIES";
	public static String NUMBER_OF_NON_IMPROVING_SPECIES = "NUMBER_OF_NON_IMPROVING_SPECIES";
	public static String AUTO_SPECIATION_THRESHOLD = "AUTO_SPECIATION_THRESHOLD";
	public static String SATURABLE_EXO = "SATURABLE_EXO";
	public static String COUPLED_EXO = "COUPLED_EXO";
	public static String SATURABLE_POLY = "SATURABLE_POLY";
	public static String COUPLED_POLY = "COUPLED_POLY";
	public static String SATURABLE_NICK = "SATURABLE_NICK";
	public static String COUPLED_NICK = "COUPLED_NICK";
	public static String EXO_SATURATION_FREE_TEMPLATES = "EXO_SATURATION_FREE_TEMPLATES";
	public static String EXO_SATURATION_TEMPLATES_ALL = "EXO_SATURATION_TEMPLATES_ALL";
	public static String KDUPLEX = "KDUPLEX";
	public static String NICKASE_ACTIVITY = "NICKASE_ACTIVITY";
	public static String POLY_ACTIVITY = "POLY_ACTIVITY";
	public static String LEMBDA = "LEMBDA";
	public static String EXO = "EXO";
	public static String EXO_INHIB = "EXO_INHIB";
	public static String DISPLACE = "DISPLACE";
	public static String EXO_VM = "EXO_VM";
	public static String EXO_KM_SIMPLE = "EXO_KM_SIMPLE";
	public static String EXO_KM_INHIB = "EXO_KM_INHIB";
	public static String EXO_KM_TEMPLATE = "EXO_KM_TEMPLATE";
	public static String POL_KM = "POL_KM";
	public static String NICK_VM = "NICK_VM";
	public static String LEAK_RATIO = "LEAK_RATIO";
	public static String TOEHOLD_LEFT = "TOEHOLD_LEFT";
	public static String TOEHOLD_RIGHT = "TOEHOLD_RIGHT";
	public static String POL_VM = "POL_VM";
	public static String POL_KM_BOTH = "POL_KM_BOTH";
	public static String NICK_KM = "NICK_KM";
	public static String RATIO_INHIBITION = "RATIO_INHIBITION";
	public static String MAX_TIME = "MAX_TIME";
	public static String NUMBER_OF_POINTS = "NUMBER_OF_POINTS";
	public static String MAX_TIME_SIMPLE = "MAX_TIME_SIMPLE";
	public static String INTER_ABS_ERROR = "INTER_ABS_ERROR";
	public static String INTER_REL_ERROR = "INTER_REL_ERROR";
	public static String THRESHOLD_STABILITY_DETECTION = "THRESHOLD_STABILITY_DETECTION";
	public static String MIN_TIME_STABLE = "MIN_TIME_STABLE";
	public static String MAX_INTEGRATION_STEPS = "MAX_INTEGRATION_STEPS";
	public static String TEMPLATE_OPTIMIZE = "TEMPLATE_OPTIMIZE";
	public static String TEMPLATE_DEFAULT = "TEMPLATE_DEFAULT";
	public static String TEMPLATE_MIN = "TEMPLATE_MIN";
	public static String TEMPLATE_MAX = "TEMPLATE_MAX";
	public static String SEQK_OPTIMIZE = "SEQK_OPTIMIZE";
	public static String SEQK_DEFAULT = "SEQK_DEFAULT";
	public static String SEQK_MIN = "SEQK_MIN";
	public static String SEQK_MAX = "SEQK_MAX";
	public static String INHK_OPTIMIZE = "INHK_OPTIMIZE";
	public static String INHK_DEFAULT = "INHK_DEFAULT";
	public static String INHK_MIN = "INHK_MIN";
	public static String INHK_MAX = "INHK_MAX";
	public static String SEQC_OPTIMIZE = "SEQC_OPTIMIZE";
	public static String SEQC_DEFAULT = "SEQC_DEFAULT";
	public static String SEQC_MIN = "SEQC_MIN";
	public static String SEQC_MAX = "SEQC_MAX";
	public static String EXOACT_OPTIMIZE = "EXOACT_OPTIMIZE";
	public static String EXOACT_DEFAULT = "EXOACT_DEFAULT";
	public static String EXOACT_MIN = "EXOACT_MIN";
	public static String EXOACT_MAX = "EXOACT_MAX";
	public static String EXOSIMPLEKM_OPTIMIZE = "EXOSIMPLEKM_OPTIMIZE";
	public static String EXOSIMPLEKM_DEFAULT = "EXOSIMPLEKM_DEFAULT";
	public static String EXOSIMPLEKM_MIN = "EXOSIMPLEKM_MIN";
	public static String EXOSIMPLEKM_MAX = "EXOSIMPLEKM_MAX";
	public static String INHIBKM_OPTIMIZE = "INHIBKM_OPTIMIZE";
	public static String INHIBKM_DEFAULT = "INHIBKM_DEFAULT";
	public static String INHIBKM_MIN = "INHIBKM_MIN";
	public static String INHIBKM_MAX = "INHIBKM_MAX";
	public static String POLACT_OPTIMIZE = "POLACT_OPTIMIZE";
	public static String POLACT_DEFAULT = "POLACT_DEFAULT";
	public static String POLACT_MIN = "POLACT_MIN";
	public static String POLACT_MAX = "POLACT_MAX";
	public static String POLKM_OPTIMIZE = "POLKM_OPTIMIZE";
	public static String POLKM_DEFAULT = "POLKM_DEFAULT";
	public static String POLKM_MIN = "POLKM_MIN";
	public static String POLKM_MAX = "POLKM_MAX";
	public static String POL2STRANDKM_OPTIMIZE = "POL2STRANDKM_OPTIMIZE";
	public static String POL2STRANDKM_DEFAULT = "POL2STRANDKM_DEFAULT";
	public static String POL2STRANDKM_MIN = "POL2STRANDKM_MIN";
	public static String POL2STRANDKM_MAX = "POL2STRANDKM_MAX";
	public static String NICKACT_OPTIMIZE = "NICKACT_OPTIMIZE";
	public static String NICKACT_DEFAULT = "NICKACT_DEFAULT";
	public static String NICKACT_MIN = "NICKACT_MIN";
	public static String NICKACT_MAX = "NICKACT_MAX";
	public static String NICKKM_OPTIMIZE = "NICKKM_OPTIMIZE";
	public static String NICKKM_DEFAULT = "NICKKM_DEFAULT";
	public static String NICKKM_MIN = "NICKKM_MIN";
	public static String NICKKM_MAX = "NICKKM_MAX";

	HashMap<String, JTextField> textFields = new HashMap<String, JTextField>();

	private Double tmp;
	private JFrame frmEvolutionFramework;
	private JTextField tfRandOrGauss;
	private JTextField tfParamOnly;
	private JTextField tfSingleGenMuta;
	private JTextField tfTempDisabled;
	private JTextField tfGauss1;
	private JTextField tfGauss2;
	private JTextField tfAddNode;
	private JTextField tfAddActivation;
	private JTextField tfMutaAftCross;
	private JTextField tfInterspCross;
	private JTextField tfMutaOnly;
	private JTextField tfPopSize;
	private JTextField tfMaxGen;
	private JTextField tfTourSize;
	private JTextField tfC3;
	private JTextField tfC1;
	private JTextField tfC2;
	private JTextField tfTargetNSpecies;
	private JTextField tfMinSpeThres;
	private JTextField tfSpeThresMod;
	private JTextField tfSpeThres;
	private JCheckBox cbExoSaturate;
	private JCheckBox cbExoCoupling;
	private JCheckBox cbPolySaturate;
	private JCheckBox cbPolyCoupling;
	private JCheckBox cbNickSaturate;
	private JCheckBox cbNickCoupling;
	private JTextField tfNRuns;
	private JTextField txtDefault;
	private JPanel panelPrototypes;
	private JCheckBox cbExoSaturateByFreeTemplates;
	private JSlider slMutaOnly;
	private JSlider slInterspCross;
	private JSlider slMutaAftCross;
	private JSlider slParamOnly;
	private JSlider slSingleGenMuta;
	private JSlider slRandOrGauss;
	private JSlider slTempDisabled;
	private JSlider slAddNode;
	private JSlider slAddActivation;
	private JCheckBox cbAutoSpeThres;
	private JComboBox cbPrototypes;
	private JLabel lblAssociationSpeedkduplex;
	private JTextField tfKduplex;
	private JLabel lblSimpleModelConstans;
	private JLabel lblNickaseActivityn;
	private JTextField tfNickAct;
	private JLabel lblPolymeraseActivityp;
	private JTextField tfPolyAct;
	private JLabel lblInhibitionFactorOf;
	private JTextField tfLembda;
	private JLabel lblExonucleaseActivityexo;
	private JLabel lblExonucleaseActivityWith;
	private JLabel lblNewLabel;
	private JTextField tfExoAct;
	private JTextField tfExoInhib;
	private JTextField tfDispl;
	private JLabel lblMichaelismentenParameters;
	private JLabel lblExovm;
	private JLabel lblForSimpleSequence;
	private JLabel lblForInhibitingSequences;
	private JLabel lblExonucleaseSaturationBy;
	private JLabel lblPolvm;
	private JLabel lblPolkm;
	private JLabel lblPolkmboth;
	private JLabel lblNickvm;
	private JLabel lblNickkm;
	private JLabel lblLeakRatio;
	private JLabel lblRatioInhibition;
	private JLabel lblRefactorToehold;
	private JTextField tfExoVm;
	private JTextField tfExoKmSimple;
	private JTextField tfExoKmInhib;
	private JTextField tfExoKmTemplate;
	private JTextField tfPolKm;
	private JTextField tfNickVm;
	private JTextField tfLeakRatio;
	private JTextField tfToeholdLeft;
	private JTextField tfPolVm;
	private JTextField tfPolKmBoth;
	private JTextField tfNickKm;
	private JTextField tfRatioInhib;
	private JLabel lblSolverParameters;
	private JLabel lblNewLabel_1;
	private JLabel lblMaxTimecomplex;
	private JLabel lblMaxTimesimple;
	private JLabel lblIntegrationAbsoluteError;
	private JLabel lblIntegrationRelativeError;
	private JTextField tfMaxTimeComplex;
	private JTextField tfNPoints;
	private JTextField tfMaxTimeSimple;
	private JTextField tfIntegrationAbsError;
	private JTextField tfIntegrationRelError;
	private JPanel panel_10;
	private JPanel panel_11;
	private JPanel panelFitness;
	private JLabel lblFitnessFuncion;
	private JComboBox cbFitnessFunction;
	private JPanel panelFitnessFunction;
	private JPanel panel_13;
	private JCheckBox cbOptTemplate;
	private JLabel lblNewLabel_2;
	private JTextField tfTemplateDefault;
	private JLabel lblMinValue;
	private JLabel lblMaxValue;
	private JTextField tfTemplateMin;
	private JTextField tfTemplateMax;
	private JPanel panelOptSignalSequenceOld;
	private JCheckBox cbOptSeqK;
	private JLabel label_3;
	private JTextField tfSeqKDefault;
	private JLabel label_4;
	private JLabel lblMaxValue_1;
	private JTextField tfSeqKMin;
	private JTextField tfSeqKMax;
	private JPanel panel_15;
	private JLabel label_6;
	private JTextField tfInhKDefault;
	private JLabel label_7;
	private JLabel lblMaxValue_2;
	private JTextField tfInhKMin;
	private JTextField tfInhKMax;
	private JLabel lblOptimizeInhibitionK;
	private JComboBox cbOptInhK;
	private JPanel panel_16;
	private JCheckBox cbOptSeqConc;
	private JLabel label_9;
	private JTextField tfSeqConcDefault;
	private JLabel label_10;
	private JLabel lblMaxValue_3;
	private JTextField tfSeqConcMin;
	private JTextField tfSeqConcMax;
	private JPanel panel_17;
	private JCheckBox cbOptExoSimpleKm;
	private JLabel label_12;
	private JTextField tfExoSimpleKmDefault;
	private JLabel label_13;
	private JLabel lblMaxValue_5;
	private JTextField tfExoSimpleKmMin;
	private JTextField tfExoSimpleKmMax;
	private JPanel panel_18;
	private JCheckBox cbOptExoAct;
	private JLabel label_15;
	private JTextField tfExoActDefault;
	private JLabel label_16;
	private JLabel lblMaxValue_4;
	private JTextField tfExoActMin;
	private JTextField tfExoActMax;
	private JPanel panel_19;
	private JCheckBox cbOptInhibKm;
	private JLabel label_18;
	private JTextField tfInhibKmDefault;
	private JLabel label_19;
	private JLabel lblMaxValue_6;
	private JTextField tfInhibKmMin;
	private JTextField tfInhibKmMax;
	private JPanel panel_20;
	private JCheckBox cbOptPolAct;
	private JLabel label_21;
	private JTextField tfPolActDefault;
	private JLabel label_22;
	private JLabel lblMaxValue_7;
	private JTextField tfPolActMin;
	private JTextField tfPolActMax;
	private JPanel panel_21;
	private JCheckBox cbOptPolKm;
	private JLabel label_24;
	private JTextField tfPolKmDefault;
	private JLabel label_25;
	private JLabel lblMaxValue_8;
	private JTextField tfPolKmMin;
	private JTextField tfPolKmMax;
	private JPanel panel_22;
	private JCheckBox cbOptPol2StrandKm;
	private JLabel label_27;
	private JTextField tfPol2StrandKmDefault;
	private JLabel label_28;
	private JLabel lblMaxValue_9;
	private JTextField tfPol2StrandKmMin;
	private JTextField tfPol2StrandKmMax;
	private JPanel panel_23;
	private JCheckBox cbOptNickAct;
	private JLabel label_30;
	private JTextField tfNickActDefault;
	private JLabel label_31;
	private JLabel lblMaxValue_10;
	private JTextField tfNickActMin;
	private JTextField tfNickActMax;
	private JPanel panel_24;
	private JCheckBox cbOptNickKm;
	private JLabel label_33;
	private JTextField tfNickKmDefault;
	private JLabel label_34;
	private JLabel lblMaxValue_11;
	private JTextField tfNickKmMin;
	private JTextField tfNickKmMax;
	private JTextField tfNNonImproveGenerations;
	private JCheckBox cbRemoveNonImprovingSpecies;
	private JPanel panelFitnessOverGeneration;
	private JPanel panelSpeciesVisualOverGeneration;
	private JPanel panelBestIndivOverGeneration;
	private JTextField tfThresholdStable;

	private RunStarter run;
	private RunConfig runConfig = new RunConfig();
	private JButton btnPauseEvolution;
	private JPanel panel_3;
	private JPanel panelSpeciation;
	private JPanel panel_27;
	private JPanel panel_28;
	private JPanel panel_6;
	private JPanel panel_29;
	private JPanel panel_30;
	private JPanel panel_8;
	private JPanel panel_31;
	private JPanel panel_7;
	private JPanel panel_32;
	private JPanel browsedStructure;
	private JLabel lblMinTimeFor;
	private JTextField tfMinTimeStable;
	private JLabel lblMaxIntegrationSteps;
	private JTextField tfMaxIntegrationSteps;
	private JLabel lblAddDouble;
	private JSlider slAddDoubleInhibition;
	private JTextField tfAddDoubleInhibition;
	private JButton btnLoadEvolution;
	private JProgressBar progressBar;
	public static JPanel panelAlgoSettings;
	private JPanel panelProbParamOnly;
	private JPanel panelProbMutation;
	private JPanel panel_33;
	private JPanel panelProbStructure;
	private JPanel panel_37;
	private JLabel lblStructure;
	private JTextField tfStructure;
	private JPanel panelStructureInside;
	private JPanel panel_39;
	private JLabel lblAddSingle;
	private JSlider slAddSingleInhibition;
	private JTextField tfAddSingleInhibition;
	private JPanel panelParamInside;
	private JPanel panel_41;
	private JSlider slStructure;
	private JPanel panel;
	private JPanel panelProbCrossover;
	private JPanel panel_42;
	private JLabel lblCrossover;
	private JSlider slCrossover;
	private JTextField tfCrossover;
	private JPanel panelCrossoverInside;
	private JPanel panel_44;
	private JLabel lblIntraspeciesCrossover;
	private JSlider slIntraspCross;
	private JTextField tfIntraspCross;
	private JPanel panelMutationAfterCrossover;
	private JPanel panel_46;
	private JPanel panelFitnessEvaluation;
	private JLabel lblFitnessEvaluation;
	private JPanel panel_26;
	private JTabbedPane tabbedPane;
	private JPanel panelResult;
	private JTextArea txtIndividual;
	private JLabel lblToeholdRight;
	private JTextField tfToeholdRight;
	private JPanel panel_4;
	private JCheckBox chckbxNewModel;
	private JPanel panelOptSignalSequenceNew;
	private JPanel panelCheckFitness;
	private JCheckBox cbExoSaturationByTemplatesAll;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			// Set cross-platform Java L&F (also called "Metal")
			UIManager.setLookAndFeel(UIManager
					.getCrossPlatformLookAndFeelClassName());
		} catch (UnsupportedLookAndFeelException e) {
			// handle exception
		} catch (ClassNotFoundException e) {
			// handle exception
		} catch (InstantiationException e) {
			// handle exception
		} catch (IllegalAccessException e) {
			// handle exception
		}
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Main window = new Main();
					window.frmEvolutionFramework.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public Main() {
		initialize();
		updateFieldsFromConstants();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frmEvolutionFramework = new JFrame();
		frmEvolutionFramework.setTitle("Evolution Framework");
		common.Static.frame = frmEvolutionFramework;
		frmEvolutionFramework.setBounds(100, 100, 1500, 880);
		frmEvolutionFramework.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		panel_4 = new JPanel();
		frmEvolutionFramework.getContentPane().add(panel_4, BorderLayout.NORTH);

		chckbxNewModel = new JCheckBox("New Model (predefined sequences)");
		chckbxNewModel.addChangeListener(new ChangeListener() {
			public void stateChanged(ChangeEvent arg0) {
				boolean swap = false;
				Constants.optimizeSeqString = chckbxNewModel.isSelected();
				if ((panelOptSignalSequenceOld.isVisible() && Constants.optimizeSeqString)
						|| (!panelOptSignalSequenceOld.isVisible() && !Constants.optimizeSeqString)) {
					MyUtil.swapPanels(panelOptSignalSequenceOld,
							panelOptSignalSequenceNew);
					swap = true;
				}
				if (Constants.optimizeSeqString) {
					if (cbOptInhK.getItemCount() == 3) {
						cbOptInhK.addItem("Preset");
					}
					if (swap) {
						cbOptInhK.setSelectedIndex(3);
					}
				} else {
					while (cbOptInhK.getItemCount() > 3) {
						cbOptInhK.removeItemAt(3);
					}
					if (swap) {
						cbOptInhK.setSelectedIndex(2);
					}
				}
			}
		});
		panel_4.add(chckbxNewModel);

		JPanel panel_1 = new JPanel();
		frmEvolutionFramework.getContentPane().add(panel_1, BorderLayout.SOUTH);

		JLabel lblNumberOfRuns = new JLabel("Number of runs");
		panel_1.add(lblNumberOfRuns);

		tfNRuns = new JTextField();
		panel_1.add(tfNRuns);
		tfNRuns.setColumns(10);

		JLabel lblOutputPrefix = new JLabel("Output prefix");
		panel_1.add(lblOutputPrefix);

		txtDefault = new JTextField();
		panel_1.add(txtDefault);
		txtDefault.setColumns(10);

		final JButton btnStartEvolution = new JButton("Start Evolution");
		btnStartEvolution.addActionListener(new ActionListener() {

			public void actionPerformed(ActionEvent arg0) {
				if (run == null || (!run.isRunning() && !run.isPaused())) {
					updateConstantsFromFields();
					HashMap<String, String> fitnessParameters = updateRunParameterFromFields();
					updateRunConfig();
					final String initialIndividual = txtIndividual.getText();

					try {
						DocumentBuilderFactory dbfac = DocumentBuilderFactory
								.newInstance();
						DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
						Document doc = docBuilder.newDocument();
						final Element fitness = doc.createElement("fitness");
						doc.appendChild(fitness);
						HashMap<String, String> parameters = new HashMap<String, String>();
						for (String str : fitnessParameters.keySet()) {
							Element parameter = doc.createElement("parameter");
							parameter.setAttribute("name", str);
							parameter.setAttribute("value",
									fitnessParameters.get(str));
							fitness.appendChild(parameter);
						}
						new Thread(new Runnable() {

							@Override
							public void run() {
								panelBestIndivOverGeneration.removeAll();
								panelFitnessOverGeneration.removeAll();
								panelSpeciesVisualOverGeneration.removeAll();
								run.initialize(runConfig, initialIndividual,
										panelFitnessOverGeneration,
										panelSpeciesVisualOverGeneration,
										panelBestIndivOverGeneration,
										progressBar, fitness);
								run.start();
							}
						}).start();
						btnStartEvolution.setText("Stop Evolution");
						btnPauseEvolution.setText("Pause Evolution");
						tabbedPane.setSelectedComponent(panelResult);
					} catch (ParserConfigurationException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}

				} else {
					if (run.isRunning() || run.isPaused()) {
						run.stop();
						btnStartEvolution.setText("Start Evolution");
						btnPauseEvolution.setText("Pause Evolution");
					}
				}
			}
		});

		JButton btnSaveSettings = new JButton("Save Settings");
		btnSaveSettings.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				JFileChooser fc = new JFileChooser();
				int returnVal;
				do {
					returnVal = fc.showSaveDialog(null);
				} while (returnVal != JFileChooser.APPROVE_OPTION
						&& returnVal != JFileChooser.CANCEL_OPTION);
				File file = fc.getSelectedFile();
				if (file != null) {
					saveFieldsToFile(file);
				}
			}
		});
		panel_1.add(btnSaveSettings);

		JButton btnLoadSettings = new JButton("Load Settings");
		btnLoadSettings.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				JFileChooser fc = new JFileChooser();
				int returnVal;
				do {
					returnVal = fc.showOpenDialog(null);
				} while (returnVal != JFileChooser.APPROVE_OPTION
						&& returnVal != JFileChooser.CANCEL_OPTION);
				File file = fc.getSelectedFile();
				if (file != null) {
					loadFieldsFromFile(file);
				}
			}
		});
		panel_1.add(btnLoadSettings);
		panel_1.add(btnStartEvolution);

		btnPauseEvolution = new JButton("Pause Evolution");
		btnPauseEvolution.addActionListener(new ActionListener() {

			public void actionPerformed(ActionEvent arg0) {
				if (run == null) {
					return;
				}
				if (run.isPaused()) {
					updateConstantsFromFields();
					updateRunParameterFromFields();
					updateRunConfig();
					run.resume();
					btnPauseEvolution.setText("Pause Evolution");
					btnStartEvolution.setText("Stop Evolution");
				} else {
					if (run.isRunning()) {
						run.pause();
						btnPauseEvolution.setText("Resume Evolution");
						btnStartEvolution.setText("Stop Evolution");
					}
				}
			}
		});
		panel_1.add(btnPauseEvolution);

		btnLoadEvolution = new JButton("Load Evolution");
		btnLoadEvolution.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		panel_1.add(btnLoadEvolution);

		tabbedPane = new JTabbedPane(JTabbedPane.TOP);
		frmEvolutionFramework.getContentPane().add(tabbedPane,
				BorderLayout.CENTER);

		JPanel panel_2 = new JPanel();
		tabbedPane.addTab("Algorithm", null, panel_2, null);
		panel_2.setLayout(null);

		panel_27 = new JPanel();
		panel_27.setBounds(10, 11, 1459, 32);
		panel_2.add(panel_27);
		GridBagLayout gbl_panel_27 = new GridBagLayout();
		gbl_panel_27.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0 };
		gbl_panel_27.rowHeights = new int[] { 0, 0 };
		gbl_panel_27.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0,
				0.0, Double.MIN_VALUE };
		gbl_panel_27.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
		panel_27.setLayout(gbl_panel_27);

		JLabel lblPopulationSize = new JLabel("Population Size");
		GridBagConstraints gbc_lblPopulationSize = new GridBagConstraints();
		gbc_lblPopulationSize.insets = new Insets(0, 0, 0, 5);
		gbc_lblPopulationSize.gridx = 0;
		gbc_lblPopulationSize.gridy = 0;
		panel_27.add(lblPopulationSize, gbc_lblPopulationSize);
		tfPopSize = new JTextField();
		GridBagConstraints gbc_tfPopSize = new GridBagConstraints();
		gbc_tfPopSize.insets = new Insets(0, 0, 0, 5);
		gbc_tfPopSize.gridx = 1;
		gbc_tfPopSize.gridy = 0;
		panel_27.add(tfPopSize, gbc_tfPopSize);
		tfPopSize.setInputVerifier(new IntInputVerifier());
		tfPopSize.setColumns(10);

		JLabel lblMaxGenerations = new JLabel("Max Generations");
		GridBagConstraints gbc_lblMaxGenerations = new GridBagConstraints();
		gbc_lblMaxGenerations.insets = new Insets(0, 0, 0, 5);
		gbc_lblMaxGenerations.gridx = 2;
		gbc_lblMaxGenerations.gridy = 0;
		panel_27.add(lblMaxGenerations, gbc_lblMaxGenerations);
		tfMaxGen = new JTextField();
		GridBagConstraints gbc_tfMaxGen = new GridBagConstraints();
		gbc_tfMaxGen.insets = new Insets(0, 0, 0, 5);
		gbc_tfMaxGen.gridx = 3;
		gbc_tfMaxGen.gridy = 0;
		panel_27.add(tfMaxGen, gbc_tfMaxGen);
		tfMaxGen.setInputVerifier(new IntInputVerifier());
		tfMaxGen.setColumns(10);

		JLabel lblTournamentSize = new JLabel("Tournament Size");
		GridBagConstraints gbc_lblTournamentSize = new GridBagConstraints();
		gbc_lblTournamentSize.insets = new Insets(0, 0, 0, 5);
		gbc_lblTournamentSize.gridx = 4;
		gbc_lblTournamentSize.gridy = 0;
		panel_27.add(lblTournamentSize, gbc_lblTournamentSize);
		tfTourSize = new JTextField();
		GridBagConstraints gbc_tfTourSize = new GridBagConstraints();
		gbc_tfTourSize.gridx = 5;
		gbc_tfTourSize.gridy = 0;
		panel_27.add(tfTourSize, gbc_tfTourSize);
		tfTourSize.setInputVerifier(new IntInputVerifier());
		tfTourSize.setColumns(10);

		panelAlgoSettings = new JPanel();
		panelAlgoSettings.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelAlgoSettings.setBounds(10, 54, 1459, 676);
		panel_2.add(panelAlgoSettings);
		panelAlgoSettings.setLayout(new BorderLayout(0, 0));

		panelProbParamOnly = new JPanel();
		panelProbParamOnly.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelProbParamOnly.setBounds(165, 53, 107, 99);

		panelProbMutation = new JPanel();
		panelProbMutation.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelProbMutation.setBounds(10, 141, 107, 99);

		JConnector[] connectors = new JConnector[11];

		ConnectorContainer cc = new ConnectorContainer(connectors);
		cc.setLayout(null);

		cc.add(panelProbParamOnly);
		panelProbParamOnly.setLayout(new BorderLayout(0, 0));

		panel_33 = new JPanel();
		panelProbParamOnly.add(panel_33, BorderLayout.CENTER);
		panel_33.setBorder(new EmptyBorder(5, 5, 5, 5));
		GridBagLayout gbl_panel_33 = new GridBagLayout();
		gbl_panel_33.columnWidths = new int[] { 0, 0 };
		gbl_panel_33.rowHeights = new int[] { 0, 0, 0, 0 };
		gbl_panel_33.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
		gbl_panel_33.rowWeights = new double[] { 0.0, 0.0, 0.0,
				Double.MIN_VALUE };
		panel_33.setLayout(gbl_panel_33);

		JLabel lblParameterOnly_1 = new JLabel("% Parameter");
		lblParameterOnly_1.setPreferredSize(new Dimension(200, 14));
		GridBagConstraints gbc_lblParameterOnly_1 = new GridBagConstraints();
		gbc_lblParameterOnly_1.insets = new Insets(0, 0, 5, 0);
		gbc_lblParameterOnly_1.gridx = 0;
		gbc_lblParameterOnly_1.gridy = 0;
		panel_33.add(lblParameterOnly_1, gbc_lblParameterOnly_1);
		slParamOnly = new JSlider();
		GridBagConstraints gbc_slParamOnly = new GridBagConstraints();
		gbc_slParamOnly.fill = GridBagConstraints.HORIZONTAL;
		gbc_slParamOnly.insets = new Insets(0, 0, 5, 0);
		gbc_slParamOnly.gridx = 0;
		gbc_slParamOnly.gridy = 1;
		panel_33.add(slParamOnly, gbc_slParamOnly);
		tfParamOnly = new JTextField();
		GridBagConstraints gbc_tfParamOnly = new GridBagConstraints();
		gbc_tfParamOnly.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfParamOnly.gridx = 0;
		gbc_tfParamOnly.gridy = 2;
		panel_33.add(tfParamOnly, gbc_tfParamOnly);
		tfParamOnly.setInputVerifier(new ProbInputVerifier());
		tfParamOnly.addFocusListener(new MyFocusListener(slParamOnly));
		slParamOnly.addChangeListener(new MyChangeListener(tfParamOnly));
		tfParamOnly.setColumns(10);
		cc.add(panelProbMutation);
		panelProbMutation.setLayout(new BorderLayout(0, 0));
		cc.setBorder(new EtchedBorder(EtchedBorder.LOWERED));
		panelAlgoSettings.add(cc);

		panelProbStructure = new JPanel();
		panelProbStructure.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelProbStructure.setBounds(165, 227, 107, 99);
		cc.add(panelProbStructure);
		panel = new JPanel();
		panel.setBorder(new EmptyBorder(5, 5, 5, 5));
		panelProbMutation.add(panel, BorderLayout.CENTER);
		GridBagLayout gbl_panel = new GridBagLayout();
		gbl_panel.columnWidths = new int[] { 0, 0 };
		gbl_panel.rowHeights = new int[] { 0, 0, 0, 0 };
		gbl_panel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
		gbl_panel.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
		panel.setLayout(gbl_panel);

		JLabel lblMutationOnly = new JLabel("% Mutation");
		GridBagConstraints gbc_lblMutationOnly = new GridBagConstraints();
		gbc_lblMutationOnly.insets = new Insets(0, 0, 5, 0);
		gbc_lblMutationOnly.gridx = 0;
		gbc_lblMutationOnly.gridy = 0;
		panel.add(lblMutationOnly, gbc_lblMutationOnly);
		slMutaOnly = new JSlider();
		GridBagConstraints gbc_slMutaOnly = new GridBagConstraints();
		gbc_slMutaOnly.insets = new Insets(0, 0, 5, 0);
		gbc_slMutaOnly.fill = GridBagConstraints.HORIZONTAL;
		gbc_slMutaOnly.gridx = 0;
		gbc_slMutaOnly.gridy = 1;
		panel.add(slMutaOnly, gbc_slMutaOnly);
		tfMutaOnly = new JTextField();
		GridBagConstraints gbc_tfMutaOnly = new GridBagConstraints();
		gbc_tfMutaOnly.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfMutaOnly.gridx = 0;
		gbc_tfMutaOnly.gridy = 2;
		panel.add(tfMutaOnly, gbc_tfMutaOnly);
		tfMutaOnly.setInputVerifier(new ProbInputVerifier());
		tfMutaOnly.setColumns(10);
		tfMutaOnly.addFocusListener(new MyFocusListener(slMutaOnly));
		slMutaOnly.addChangeListener(new MyChangeListener(tfMutaOnly));

		panelProbStructure.setLayout(new BorderLayout(0, 0));

		panel_37 = new JPanel();
		panel_37.setBorder(new EmptyBorder(5, 5, 5, 5));
		panelProbStructure.add(panel_37, BorderLayout.CENTER);
		GridBagLayout gbl_panel_37 = new GridBagLayout();
		gbl_panel_37.columnWidths = new int[] { 0, 0 };
		gbl_panel_37.rowHeights = new int[] { 0, 0, 0, 0 };
		gbl_panel_37.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
		gbl_panel_37.rowWeights = new double[] { 0.0, 0.0, 0.0,
				Double.MIN_VALUE };
		panel_37.setLayout(gbl_panel_37);

		lblStructure = new JLabel("% Structure");
		GridBagConstraints gbc_lblStructure = new GridBagConstraints();
		gbc_lblStructure.insets = new Insets(0, 0, 5, 0);
		gbc_lblStructure.gridx = 0;
		gbc_lblStructure.gridy = 0;
		panel_37.add(lblStructure, gbc_lblStructure);

		slStructure = new JSlider();
		slStructure.setValue(90);
		GridBagConstraints gbc_slStructure = new GridBagConstraints();
		gbc_slStructure.fill = GridBagConstraints.HORIZONTAL;
		gbc_slStructure.insets = new Insets(0, 0, 5, 0);
		gbc_slStructure.gridx = 0;
		gbc_slStructure.gridy = 1;
		panel_37.add(slStructure, gbc_slStructure);

		tfStructure = new JTextField();
		tfStructure.setText("0.9");
		tfStructure.setColumns(10);
		GridBagConstraints gbc_tfStructure = new GridBagConstraints();
		gbc_tfStructure.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfStructure.gridx = 0;
		gbc_tfStructure.gridy = 2;
		panel_37.add(tfStructure, gbc_tfStructure);
		tfStructure.addFocusListener(new MyFocusListener(slStructure));
		slStructure.addChangeListener(new MyChangeListener(tfStructure));

		panelStructureInside = new JPanel();
		panelStructureInside.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelStructureInside.setBounds(325, 205, 434, 142);
		cc.add(panelStructureInside);
		panelStructureInside.setLayout(new BorderLayout(0, 0));

		panel_39 = new JPanel();
		panelStructureInside.add(panel_39, BorderLayout.CENTER);
		panel_39.setBorder(new EmptyBorder(5, 5, 5, 5));
		GridBagLayout gbl_panel_39 = new GridBagLayout();
		gbl_panel_39.columnWidths = new int[] { 0, 239, 52, 0 };
		gbl_panel_39.rowHeights = new int[] { 0, 0, 0, 0, 0, 0 };
		gbl_panel_39.columnWeights = new double[] { 0.0, 1.0, 1.0,
				Double.MIN_VALUE };
		gbl_panel_39.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0,
				Double.MIN_VALUE };
		panel_39.setLayout(gbl_panel_39);

		JLabel label = new JLabel("% Add Node");
		GridBagConstraints gbc_label = new GridBagConstraints();
		gbc_label.anchor = GridBagConstraints.WEST;
		gbc_label.insets = new Insets(0, 0, 5, 5);
		gbc_label.gridx = 0;
		gbc_label.gridy = 0;
		panel_39.add(label, gbc_label);
		slAddNode = new JSlider();
		GridBagConstraints gbc_slAddNode = new GridBagConstraints();
		gbc_slAddNode.fill = GridBagConstraints.HORIZONTAL;
		gbc_slAddNode.insets = new Insets(0, 0, 5, 5);
		gbc_slAddNode.gridx = 1;
		gbc_slAddNode.gridy = 0;
		panel_39.add(slAddNode, gbc_slAddNode);
		tfAddNode = new JTextField();
		GridBagConstraints gbc_tfAddNode = new GridBagConstraints();
		gbc_tfAddNode.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfAddNode.insets = new Insets(0, 0, 5, 0);
		gbc_tfAddNode.gridx = 2;
		gbc_tfAddNode.gridy = 0;
		panel_39.add(tfAddNode, gbc_tfAddNode);
		tfAddNode.setInputVerifier(new ProbInputVerifier());
		tfAddNode.setColumns(10);
		tfAddNode.addFocusListener(new MyFocusListener(slAddNode));
		slAddNode.addChangeListener(new MyChangeListener(tfAddNode));

		JLabel label_1 = new JLabel("% Add Activation");
		GridBagConstraints gbc_label_1 = new GridBagConstraints();
		gbc_label_1.anchor = GridBagConstraints.WEST;
		gbc_label_1.insets = new Insets(0, 0, 5, 5);
		gbc_label_1.gridx = 0;
		gbc_label_1.gridy = 1;
		panel_39.add(label_1, gbc_label_1);
		slAddActivation = new JSlider();
		GridBagConstraints gbc_slAddActivation = new GridBagConstraints();
		gbc_slAddActivation.fill = GridBagConstraints.HORIZONTAL;
		gbc_slAddActivation.insets = new Insets(0, 0, 5, 5);
		gbc_slAddActivation.gridx = 1;
		gbc_slAddActivation.gridy = 1;
		panel_39.add(slAddActivation, gbc_slAddActivation);
		tfAddActivation = new JTextField();
		GridBagConstraints gbc_tfAddActivation = new GridBagConstraints();
		gbc_tfAddActivation.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfAddActivation.insets = new Insets(0, 0, 5, 0);
		gbc_tfAddActivation.gridx = 2;
		gbc_tfAddActivation.gridy = 1;
		panel_39.add(tfAddActivation, gbc_tfAddActivation);
		tfAddActivation.setInputVerifier(new ProbInputVerifier());
		tfAddActivation.setColumns(10);
		tfAddActivation.addFocusListener(new MyFocusListener(slAddActivation));
		slAddActivation
				.addChangeListener(new MyChangeListener(tfAddActivation));

		lblAddDouble = new JLabel("% Add Double Inhibition");
		GridBagConstraints gbc_lblAddDouble = new GridBagConstraints();
		gbc_lblAddDouble.anchor = GridBagConstraints.WEST;
		gbc_lblAddDouble.insets = new Insets(0, 0, 5, 5);
		gbc_lblAddDouble.gridx = 0;
		gbc_lblAddDouble.gridy = 2;
		panel_39.add(lblAddDouble, gbc_lblAddDouble);

		slAddDoubleInhibition = new JSlider();
		GridBagConstraints gbc_slAddDoubleInhibition = new GridBagConstraints();
		gbc_slAddDoubleInhibition.fill = GridBagConstraints.HORIZONTAL;
		gbc_slAddDoubleInhibition.insets = new Insets(0, 0, 5, 5);
		gbc_slAddDoubleInhibition.gridx = 1;
		gbc_slAddDoubleInhibition.gridy = 2;
		panel_39.add(slAddDoubleInhibition, gbc_slAddDoubleInhibition);
		slAddDoubleInhibition.setValue(20);
		tfAddDoubleInhibition = new JTextField();
		GridBagConstraints gbc_tfAddDoubleInhibition = new GridBagConstraints();
		gbc_tfAddDoubleInhibition.insets = new Insets(0, 0, 5, 0);
		gbc_tfAddDoubleInhibition.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfAddDoubleInhibition.gridx = 2;
		gbc_tfAddDoubleInhibition.gridy = 2;
		panel_39.add(tfAddDoubleInhibition, gbc_tfAddDoubleInhibition);
		tfAddDoubleInhibition.setText("0.2");
		tfAddDoubleInhibition.setColumns(10);
		tfAddDoubleInhibition.setInputVerifier(new ProbInputVerifier());
		tfAddDoubleInhibition.setColumns(10);
		tfAddDoubleInhibition.addFocusListener(new MyFocusListener(
				slAddDoubleInhibition));
		slAddDoubleInhibition.addChangeListener(new MyChangeListener(
				tfAddDoubleInhibition));

		lblAddSingle = new JLabel("% Add Single Inhibition");
		GridBagConstraints gbc_lblAddSingle = new GridBagConstraints();
		gbc_lblAddSingle.anchor = GridBagConstraints.WEST;
		gbc_lblAddSingle.insets = new Insets(0, 0, 5, 5);
		gbc_lblAddSingle.gridx = 0;
		gbc_lblAddSingle.gridy = 3;
		panel_39.add(lblAddSingle, gbc_lblAddSingle);

		slAddSingleInhibition = new JSlider();
		slAddSingleInhibition.setEnabled(false);
		slAddSingleInhibition.setValue(17);
		GridBagConstraints gbc_slAddSingleInhibition = new GridBagConstraints();
		gbc_slAddSingleInhibition.fill = GridBagConstraints.HORIZONTAL;
		gbc_slAddSingleInhibition.insets = new Insets(0, 0, 5, 5);
		gbc_slAddSingleInhibition.gridx = 1;
		gbc_slAddSingleInhibition.gridy = 3;
		panel_39.add(slAddSingleInhibition, gbc_slAddSingleInhibition);

		tfAddSingleInhibition = new JTextField();
		tfAddSingleInhibition.setEnabled(false);
		tfAddSingleInhibition.setText("0.17");
		tfAddSingleInhibition.setColumns(10);
		GridBagConstraints gbc_tfAddSingleInhibition = new GridBagConstraints();
		gbc_tfAddSingleInhibition.insets = new Insets(0, 0, 5, 0);
		gbc_tfAddSingleInhibition.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfAddSingleInhibition.gridx = 2;
		gbc_tfAddSingleInhibition.gridy = 3;
		panel_39.add(tfAddSingleInhibition, gbc_tfAddSingleInhibition);
		tfAddSingleInhibition.addFocusListener(new MyFocusListener(
				slAddSingleInhibition));
		slAddSingleInhibition.addChangeListener(new MyChangeListener(
				tfAddSingleInhibition));

		panelParamInside = new JPanel();
		panelParamInside.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelParamInside.setBounds(325, 11, 434, 183);
		cc.add(panelParamInside);
		panelParamInside.setLayout(new BorderLayout(0, 0));

		panel_41 = new JPanel();
		panel_41.setBorder(new EmptyBorder(5, 5, 5, 5));
		panelParamInside.add(panel_41, BorderLayout.CENTER);
		GridBagLayout gbl_panel_41 = new GridBagLayout();
		gbl_panel_41.columnWidths = new int[] { 0, 230, 49, 0 };
		gbl_panel_41.rowHeights = new int[] { 0, 0, 0, 0, 0, 0 };
		gbl_panel_41.columnWeights = new double[] { 0.0, 1.0, 1.0,
				Double.MIN_VALUE };
		gbl_panel_41.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0,
				Double.MIN_VALUE };
		panel_41.setLayout(gbl_panel_41);

		JLabel lblMutateSingle = new JLabel("% Single gene mutated");
		GridBagConstraints gbc_lblMutateSingle = new GridBagConstraints();
		gbc_lblMutateSingle.anchor = GridBagConstraints.WEST;
		gbc_lblMutateSingle.insets = new Insets(0, 0, 5, 5);
		gbc_lblMutateSingle.gridx = 0;
		gbc_lblMutateSingle.gridy = 0;
		panel_41.add(lblMutateSingle, gbc_lblMutateSingle);
		slSingleGenMuta = new JSlider();
		GridBagConstraints gbc_slSingleGenMuta = new GridBagConstraints();
		gbc_slSingleGenMuta.fill = GridBagConstraints.HORIZONTAL;
		gbc_slSingleGenMuta.insets = new Insets(0, 0, 5, 5);
		gbc_slSingleGenMuta.gridx = 1;
		gbc_slSingleGenMuta.gridy = 0;
		panel_41.add(slSingleGenMuta, gbc_slSingleGenMuta);
		tfSingleGenMuta = new JTextField();
		GridBagConstraints gbc_tfSingleGenMuta = new GridBagConstraints();
		gbc_tfSingleGenMuta.insets = new Insets(0, 0, 5, 0);
		gbc_tfSingleGenMuta.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfSingleGenMuta.gridx = 2;
		gbc_tfSingleGenMuta.gridy = 0;
		panel_41.add(tfSingleGenMuta, gbc_tfSingleGenMuta);
		tfSingleGenMuta.setInputVerifier(new ProbInputVerifier());
		tfSingleGenMuta.setColumns(10);
		tfSingleGenMuta.addFocusListener(new MyFocusListener(slSingleGenMuta));
		slSingleGenMuta
				.addChangeListener(new MyChangeListener(tfSingleGenMuta));

		JLabel lblSingle = new JLabel("% Random over gaussian");
		GridBagConstraints gbc_lblSingle = new GridBagConstraints();
		gbc_lblSingle.anchor = GridBagConstraints.WEST;
		gbc_lblSingle.insets = new Insets(0, 0, 5, 5);
		gbc_lblSingle.gridx = 0;
		gbc_lblSingle.gridy = 1;
		panel_41.add(lblSingle, gbc_lblSingle);
		slRandOrGauss = new JSlider();
		GridBagConstraints gbc_slRandOrGauss = new GridBagConstraints();
		gbc_slRandOrGauss.fill = GridBagConstraints.HORIZONTAL;
		gbc_slRandOrGauss.insets = new Insets(0, 0, 5, 5);
		gbc_slRandOrGauss.gridx = 1;
		gbc_slRandOrGauss.gridy = 1;
		panel_41.add(slRandOrGauss, gbc_slRandOrGauss);
		tfRandOrGauss = new JTextField();
		GridBagConstraints gbc_tfRandOrGauss = new GridBagConstraints();
		gbc_tfRandOrGauss.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfRandOrGauss.insets = new Insets(0, 0, 5, 0);
		gbc_tfRandOrGauss.gridx = 2;
		gbc_tfRandOrGauss.gridy = 1;
		panel_41.add(tfRandOrGauss, gbc_tfRandOrGauss);
		tfRandOrGauss.setInputVerifier(new ProbInputVerifier());
		tfRandOrGauss.setColumns(10);
		tfRandOrGauss.addFocusListener(new MyFocusListener(slRandOrGauss));
		slRandOrGauss.addChangeListener(new MyChangeListener(tfRandOrGauss));

		JLabel lblTemplateDisabled_1 = new JLabel("% Template Disabled");
		GridBagConstraints gbc_lblTemplateDisabled_1 = new GridBagConstraints();
		gbc_lblTemplateDisabled_1.anchor = GridBagConstraints.WEST;
		gbc_lblTemplateDisabled_1.insets = new Insets(0, 0, 5, 5);
		gbc_lblTemplateDisabled_1.gridx = 0;
		gbc_lblTemplateDisabled_1.gridy = 2;
		panel_41.add(lblTemplateDisabled_1, gbc_lblTemplateDisabled_1);
		slTempDisabled = new JSlider();
		GridBagConstraints gbc_slTempDisabled = new GridBagConstraints();
		gbc_slTempDisabled.fill = GridBagConstraints.HORIZONTAL;
		gbc_slTempDisabled.insets = new Insets(0, 0, 5, 5);
		gbc_slTempDisabled.gridx = 1;
		gbc_slTempDisabled.gridy = 2;
		panel_41.add(slTempDisabled, gbc_slTempDisabled);
		tfTempDisabled = new JTextField();
		GridBagConstraints gbc_tfTempDisabled = new GridBagConstraints();
		gbc_tfTempDisabled.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfTempDisabled.insets = new Insets(0, 0, 5, 0);
		gbc_tfTempDisabled.gridx = 2;
		gbc_tfTempDisabled.gridy = 2;
		panel_41.add(tfTempDisabled, gbc_tfTempDisabled);
		tfTempDisabled.setInputVerifier(new ProbInputVerifier());
		tfTempDisabled.setColumns(10);
		tfTempDisabled.addFocusListener(new MyFocusListener(slTempDisabled));
		slTempDisabled.addChangeListener(new MyChangeListener(tfTempDisabled));

		JLabel lblTemplateDisabled = new JLabel(
				"Standard deviation of multiplicative noise");
		GridBagConstraints gbc_lblTemplateDisabled = new GridBagConstraints();
		gbc_lblTemplateDisabled.anchor = GridBagConstraints.WEST;
		gbc_lblTemplateDisabled.insets = new Insets(0, 0, 5, 5);
		gbc_lblTemplateDisabled.gridx = 0;
		gbc_lblTemplateDisabled.gridy = 3;
		panel_41.add(lblTemplateDisabled, gbc_lblTemplateDisabled);
		lblTemplateDisabled.setToolTipText("Explanation needed");
		tfGauss1 = new JTextField();
		GridBagConstraints gbc_tfGauss1 = new GridBagConstraints();
		gbc_tfGauss1.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfGauss1.insets = new Insets(0, 0, 5, 0);
		gbc_tfGauss1.gridx = 2;
		gbc_tfGauss1.gridy = 3;
		panel_41.add(tfGauss1, gbc_tfGauss1);
		tfGauss1.setInputVerifier(new DoubleInputVerifier());
		tfGauss1.setColumns(10);

		JLabel lblAddActivation = new JLabel(
				"Standard deviation of additive noise");
		GridBagConstraints gbc_lblAddActivation = new GridBagConstraints();
		gbc_lblAddActivation.anchor = GridBagConstraints.WEST;
		gbc_lblAddActivation.insets = new Insets(0, 0, 0, 5);
		gbc_lblAddActivation.gridx = 0;
		gbc_lblAddActivation.gridy = 4;
		panel_41.add(lblAddActivation, gbc_lblAddActivation);
		lblAddActivation.setToolTipText("Explanation needed");
		tfGauss2 = new JTextField();
		GridBagConstraints gbc_tfGauss2 = new GridBagConstraints();
		gbc_tfGauss2.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfGauss2.gridx = 2;
		gbc_tfGauss2.gridy = 4;
		panel_41.add(tfGauss2, gbc_tfGauss2);
		tfGauss2.setInputVerifier(new DoubleInputVerifier());
		tfGauss2.setColumns(10);

		panelProbCrossover = new JPanel();
		panelProbCrossover.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelProbCrossover.setBounds(10, 564, 107, 99);
		cc.add(panelProbCrossover);
		panelProbCrossover.setLayout(new BorderLayout(0, 0));

		panel_42 = new JPanel();
		panel_42.setBorder(new EmptyBorder(5, 5, 5, 5));
		panelProbCrossover.add(panel_42, BorderLayout.CENTER);
		GridBagLayout gbl_panel_42 = new GridBagLayout();
		gbl_panel_42.columnWidths = new int[] { 0, 0 };
		gbl_panel_42.rowHeights = new int[] { 0, 0, 0, 0 };
		gbl_panel_42.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
		gbl_panel_42.rowWeights = new double[] { 0.0, 0.0, 0.0,
				Double.MIN_VALUE };
		panel_42.setLayout(gbl_panel_42);

		lblCrossover = new JLabel("% Crossover");
		GridBagConstraints gbc_lblCrossover = new GridBagConstraints();
		gbc_lblCrossover.insets = new Insets(0, 0, 5, 0);
		gbc_lblCrossover.gridx = 0;
		gbc_lblCrossover.gridy = 0;
		panel_42.add(lblCrossover, gbc_lblCrossover);

		slCrossover = new JSlider();
		slCrossover.setValue(50);
		GridBagConstraints gbc_slCrossover = new GridBagConstraints();
		gbc_slCrossover.fill = GridBagConstraints.HORIZONTAL;
		gbc_slCrossover.insets = new Insets(0, 0, 5, 0);
		gbc_slCrossover.gridx = 0;
		gbc_slCrossover.gridy = 1;
		panel_42.add(slCrossover, gbc_slCrossover);

		tfCrossover = new JTextField();
		tfCrossover.setText("0.5");
		tfCrossover.setColumns(10);
		GridBagConstraints gbc_tfCrossover = new GridBagConstraints();
		gbc_tfCrossover.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfCrossover.gridx = 0;
		gbc_tfCrossover.gridy = 2;
		panel_42.add(tfCrossover, gbc_tfCrossover);
		tfCrossover.addFocusListener(new MyFocusListener(slCrossover));
		slCrossover.addChangeListener(new MyChangeListener(tfCrossover));

		panelCrossoverInside = new JPanel();
		panelCrossoverInside.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelCrossoverInside.setBounds(184, 564, 312, 99);
		cc.add(panelCrossoverInside);
		panelCrossoverInside.setLayout(new BorderLayout(0, 0));

		panel_44 = new JPanel();
		panel_44.setBorder(new EmptyBorder(5, 5, 5, 5));
		panelCrossoverInside.add(panel_44, BorderLayout.CENTER);
		GridBagLayout gbl_panel_44 = new GridBagLayout();
		gbl_panel_44.columnWidths = new int[] { 0, 0, 0, 0 };
		gbl_panel_44.rowHeights = new int[] { 0, 0, 0 };
		gbl_panel_44.columnWeights = new double[] { 0.0, 1.0, 1.0,
				Double.MIN_VALUE };
		gbl_panel_44.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
		panel_44.setLayout(gbl_panel_44);

		JLabel lblInterspeciesCrossover = new JLabel("% Interspecies Crossover");
		GridBagConstraints gbc_lblInterspeciesCrossover = new GridBagConstraints();
		gbc_lblInterspeciesCrossover.insets = new Insets(0, 0, 5, 5);
		gbc_lblInterspeciesCrossover.gridx = 0;
		gbc_lblInterspeciesCrossover.gridy = 0;
		panel_44.add(lblInterspeciesCrossover, gbc_lblInterspeciesCrossover);
		slInterspCross = new JSlider();
		GridBagConstraints gbc_slInterspCross = new GridBagConstraints();
		gbc_slInterspCross.fill = GridBagConstraints.HORIZONTAL;
		gbc_slInterspCross.insets = new Insets(0, 0, 5, 5);
		gbc_slInterspCross.gridx = 1;
		gbc_slInterspCross.gridy = 0;
		panel_44.add(slInterspCross, gbc_slInterspCross);
		tfInterspCross = new JTextField();
		GridBagConstraints gbc_tfInterspCross = new GridBagConstraints();
		gbc_tfInterspCross.insets = new Insets(0, 0, 5, 0);
		gbc_tfInterspCross.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfInterspCross.gridx = 2;
		gbc_tfInterspCross.gridy = 0;
		panel_44.add(tfInterspCross, gbc_tfInterspCross);
		tfInterspCross.setSize(new Dimension(90, 20));
		tfInterspCross.setInputVerifier(new ProbInputVerifier());
		tfInterspCross.setColumns(10);
		tfInterspCross.addFocusListener(new MyFocusListener(slInterspCross));
		slInterspCross.addChangeListener(new MyChangeListener(tfInterspCross));

		lblIntraspeciesCrossover = new JLabel("% Intraspecies Crossover");
		GridBagConstraints gbc_lblIntraspeciesCrossover = new GridBagConstraints();
		gbc_lblIntraspeciesCrossover.insets = new Insets(0, 0, 0, 5);
		gbc_lblIntraspeciesCrossover.gridx = 0;
		gbc_lblIntraspeciesCrossover.gridy = 1;
		panel_44.add(lblIntraspeciesCrossover, gbc_lblIntraspeciesCrossover);

		slIntraspCross = new JSlider();
		slIntraspCross.setValue(1);
		GridBagConstraints gbc_slIntraspCross = new GridBagConstraints();
		gbc_slIntraspCross.fill = GridBagConstraints.HORIZONTAL;
		gbc_slIntraspCross.insets = new Insets(0, 0, 0, 5);
		gbc_slIntraspCross.gridx = 1;
		gbc_slIntraspCross.gridy = 1;
		panel_44.add(slIntraspCross, gbc_slIntraspCross);

		tfIntraspCross = new JTextField();
		tfIntraspCross.setText("0.01");
		tfIntraspCross.setSize(new Dimension(90, 20));
		tfIntraspCross.setColumns(10);
		GridBagConstraints gbc_tfIntraspCross = new GridBagConstraints();
		gbc_tfIntraspCross.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfIntraspCross.gridx = 2;
		gbc_tfIntraspCross.gridy = 1;
		panel_44.add(tfIntraspCross, gbc_tfIntraspCross);
		tfIntraspCross.addFocusListener(new MyFocusListener(slIntraspCross));
		slIntraspCross.addChangeListener(new MyChangeListener(tfIntraspCross));

		panelSpeciation = new JPanel();
		panelSpeciation.setBounds(855, 11, 431, 391);
		cc.add(panelSpeciation);
		panelSpeciation.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelSpeciation.setLayout(new BorderLayout(0, 0));

		panel_3 = new JPanel();
		panelSpeciation.add(panel_3);
		panel_3.setBorder(new EmptyBorder(10, 10, 10, 10));
		GridBagLayout gbl_panel_3 = new GridBagLayout();
		gbl_panel_3.columnWidths = new int[] { 0, 0, 0 };
		gbl_panel_3.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
		gbl_panel_3.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
		gbl_panel_3.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
				0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
		panel_3.setLayout(gbl_panel_3);

		JLabel lblSpeciation = new JLabel("Speciation:");
		GridBagConstraints gbc_lblSpeciation = new GridBagConstraints();
		gbc_lblSpeciation.anchor = GridBagConstraints.WEST;
		gbc_lblSpeciation.insets = new Insets(0, 0, 5, 5);
		gbc_lblSpeciation.gridx = 0;
		gbc_lblSpeciation.gridy = 0;
		panel_3.add(lblSpeciation, gbc_lblSpeciation);

		JLabel lblCoeficient = new JLabel("Coefficient 1");
		GridBagConstraints gbc_lblCoeficient = new GridBagConstraints();
		gbc_lblCoeficient.anchor = GridBagConstraints.WEST;
		gbc_lblCoeficient.insets = new Insets(0, 0, 5, 5);
		gbc_lblCoeficient.gridx = 0;
		gbc_lblCoeficient.gridy = 1;
		panel_3.add(lblCoeficient, gbc_lblCoeficient);
		tfC1 = new JTextField();
		GridBagConstraints gbc_tfC1 = new GridBagConstraints();
		gbc_tfC1.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfC1.weightx = 0.5;
		gbc_tfC1.insets = new Insets(0, 0, 5, 0);
		gbc_tfC1.gridx = 1;
		gbc_tfC1.gridy = 1;
		panel_3.add(tfC1, gbc_tfC1);
		tfC1.setInputVerifier(new DoubleInputVerifier());
		tfC1.setColumns(10);

		JLabel lblCoefficient = new JLabel("Coefficient 2");
		GridBagConstraints gbc_lblCoefficient = new GridBagConstraints();
		gbc_lblCoefficient.anchor = GridBagConstraints.WEST;
		gbc_lblCoefficient.insets = new Insets(0, 0, 5, 5);
		gbc_lblCoefficient.gridx = 0;
		gbc_lblCoefficient.gridy = 2;
		panel_3.add(lblCoefficient, gbc_lblCoefficient);
		tfC2 = new JTextField();
		GridBagConstraints gbc_tfC2 = new GridBagConstraints();
		gbc_tfC2.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfC2.insets = new Insets(0, 0, 5, 0);
		gbc_tfC2.gridx = 1;
		gbc_tfC2.gridy = 2;
		panel_3.add(tfC2, gbc_tfC2);
		tfC2.setInputVerifier(new DoubleInputVerifier());
		tfC2.setColumns(10);

		JLabel lblCoefficient_1 = new JLabel("Coefficient 3");
		GridBagConstraints gbc_lblCoefficient_1 = new GridBagConstraints();
		gbc_lblCoefficient_1.anchor = GridBagConstraints.WEST;
		gbc_lblCoefficient_1.insets = new Insets(0, 0, 5, 5);
		gbc_lblCoefficient_1.gridx = 0;
		gbc_lblCoefficient_1.gridy = 3;
		panel_3.add(lblCoefficient_1, gbc_lblCoefficient_1);
		tfC3 = new JTextField();
		GridBagConstraints gbc_tfC3 = new GridBagConstraints();
		gbc_tfC3.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfC3.insets = new Insets(0, 0, 5, 0);
		gbc_tfC3.gridx = 1;
		gbc_tfC3.gridy = 3;
		panel_3.add(tfC3, gbc_tfC3);
		tfC3.setInputVerifier(new DoubleInputVerifier());
		tfC3.setColumns(10);

		JLabel lblSpeciationThreshold = new JLabel("Speciation threshold");
		GridBagConstraints gbc_lblSpeciationThreshold = new GridBagConstraints();
		gbc_lblSpeciationThreshold.anchor = GridBagConstraints.WEST;
		gbc_lblSpeciationThreshold.insets = new Insets(0, 0, 5, 5);
		gbc_lblSpeciationThreshold.gridx = 0;
		gbc_lblSpeciationThreshold.gridy = 4;
		panel_3.add(lblSpeciationThreshold, gbc_lblSpeciationThreshold);
		tfSpeThres = new JTextField();
		GridBagConstraints gbc_tfSpeThres = new GridBagConstraints();
		gbc_tfSpeThres.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfSpeThres.insets = new Insets(0, 0, 5, 0);
		gbc_tfSpeThres.gridx = 1;
		gbc_tfSpeThres.gridy = 4;
		panel_3.add(tfSpeThres, gbc_tfSpeThres);
		tfSpeThres.setInputVerifier(new DoubleInputVerifier());
		tfSpeThres.setColumns(10);

		cbAutoSpeThres = new JCheckBox("Auto speciation threshold");
		GridBagConstraints gbc_cbAutoSpeThres = new GridBagConstraints();
		gbc_cbAutoSpeThres.anchor = GridBagConstraints.WEST;
		gbc_cbAutoSpeThres.insets = new Insets(0, 0, 5, 5);
		gbc_cbAutoSpeThres.gridx = 0;
		gbc_cbAutoSpeThres.gridy = 5;
		panel_3.add(cbAutoSpeThres, gbc_cbAutoSpeThres);

		JLabel lblTargetNumberOf = new JLabel("Target number of species");
		GridBagConstraints gbc_lblTargetNumberOf = new GridBagConstraints();
		gbc_lblTargetNumberOf.anchor = GridBagConstraints.WEST;
		gbc_lblTargetNumberOf.insets = new Insets(0, 0, 5, 5);
		gbc_lblTargetNumberOf.gridx = 0;
		gbc_lblTargetNumberOf.gridy = 6;
		panel_3.add(lblTargetNumberOf, gbc_lblTargetNumberOf);
		tfTargetNSpecies = new JTextField();
		GridBagConstraints gbc_tfTargetNSpecies = new GridBagConstraints();
		gbc_tfTargetNSpecies.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfTargetNSpecies.insets = new Insets(0, 0, 5, 0);
		gbc_tfTargetNSpecies.gridx = 1;
		gbc_tfTargetNSpecies.gridy = 6;
		panel_3.add(tfTargetNSpecies, gbc_tfTargetNSpecies);
		tfTargetNSpecies.setInputVerifier(new IntInputVerifier());
		tfTargetNSpecies.setColumns(10);

		JLabel lblMinSpeciationThreshold = new JLabel(
				"Min speciation threshold");
		GridBagConstraints gbc_lblMinSpeciationThreshold = new GridBagConstraints();
		gbc_lblMinSpeciationThreshold.anchor = GridBagConstraints.WEST;
		gbc_lblMinSpeciationThreshold.insets = new Insets(0, 0, 5, 5);
		gbc_lblMinSpeciationThreshold.gridx = 0;
		gbc_lblMinSpeciationThreshold.gridy = 7;
		panel_3.add(lblMinSpeciationThreshold, gbc_lblMinSpeciationThreshold);
		tfMinSpeThres = new JTextField();
		GridBagConstraints gbc_tfMinSpeThres = new GridBagConstraints();
		gbc_tfMinSpeThres.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfMinSpeThres.insets = new Insets(0, 0, 5, 0);
		gbc_tfMinSpeThres.gridx = 1;
		gbc_tfMinSpeThres.gridy = 7;
		panel_3.add(tfMinSpeThres, gbc_tfMinSpeThres);
		tfMinSpeThres.setInputVerifier(new DoubleInputVerifier());
		tfMinSpeThres.setColumns(10);

		JLabel lblSpeciationThresholdMod = new JLabel(
				"Speciation threshold modification step");
		GridBagConstraints gbc_lblSpeciationThresholdMod = new GridBagConstraints();
		gbc_lblSpeciationThresholdMod.anchor = GridBagConstraints.WEST;
		gbc_lblSpeciationThresholdMod.insets = new Insets(0, 0, 5, 5);
		gbc_lblSpeciationThresholdMod.gridx = 0;
		gbc_lblSpeciationThresholdMod.gridy = 8;
		panel_3.add(lblSpeciationThresholdMod, gbc_lblSpeciationThresholdMod);
		tfSpeThresMod = new JTextField();
		GridBagConstraints gbc_tfSpeThresMod = new GridBagConstraints();
		gbc_tfSpeThresMod.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfSpeThresMod.insets = new Insets(0, 0, 5, 0);
		gbc_tfSpeThresMod.gridx = 1;
		gbc_tfSpeThresMod.gridy = 8;
		panel_3.add(tfSpeThresMod, gbc_tfSpeThresMod);
		tfSpeThresMod.setInputVerifier(new DoubleInputVerifier());
		tfSpeThresMod.setColumns(10);

		tfNNonImproveGenerations = new JTextField();
		GridBagConstraints gbc_tfNNonImproveGenerations = new GridBagConstraints();
		gbc_tfNNonImproveGenerations.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfNNonImproveGenerations.gridx = 1;
		gbc_tfNNonImproveGenerations.gridy = 10;
		panel_3.add(tfNNonImproveGenerations, gbc_tfNNonImproveGenerations);
		tfNNonImproveGenerations.setText("0.1");
		tfNNonImproveGenerations.setColumns(10);
		tfNNonImproveGenerations.setInputVerifier(new IntInputVerifier());
		cbAutoSpeThres.addChangeListener(new ChangeListener() {

			@Override
			public void stateChanged(ChangeEvent e) {
				JCheckBox cb = (JCheckBox) e.getSource();
				if (cb.isSelected()) {
					tfTargetNSpecies.setEnabled(true);
					tfMinSpeThres.setEnabled(true);
					tfSpeThresMod.setEnabled(true);
				} else {
					tfTargetNSpecies.setEnabled(false);
					tfMinSpeThres.setEnabled(false);
					tfSpeThresMod.setEnabled(false);
				}
			}
		});

		cbRemoveNonImprovingSpecies = new JCheckBox(
				"Remove Non-Improving Species");
		GridBagConstraints gbc_cbRemoveNonImprovingSpecies = new GridBagConstraints();
		gbc_cbRemoveNonImprovingSpecies.anchor = GridBagConstraints.WEST;
		gbc_cbRemoveNonImprovingSpecies.insets = new Insets(0, 0, 5, 5);
		gbc_cbRemoveNonImprovingSpecies.gridx = 0;
		gbc_cbRemoveNonImprovingSpecies.gridy = 9;
		panel_3.add(cbRemoveNonImprovingSpecies,
				gbc_cbRemoveNonImprovingSpecies);
		cbRemoveNonImprovingSpecies.addChangeListener(new ChangeListener() {
			public void stateChanged(ChangeEvent arg0) {
				tfNNonImproveGenerations.setEnabled(((JCheckBox) arg0
						.getSource()).isSelected());
			}
		});
		cbRemoveNonImprovingSpecies.setSelected(true);

		JLabel lblNumberOfNonimproving = new JLabel(
				"Number of non-improving generations");
		GridBagConstraints gbc_lblNumberOfNonimproving = new GridBagConstraints();
		gbc_lblNumberOfNonimproving.anchor = GridBagConstraints.WEST;
		gbc_lblNumberOfNonimproving.insets = new Insets(0, 0, 0, 5);
		gbc_lblNumberOfNonimproving.gridx = 0;
		gbc_lblNumberOfNonimproving.gridy = 10;
		panel_3.add(lblNumberOfNonimproving, gbc_lblNumberOfNonimproving);

		panelMutationAfterCrossover = new JPanel();
		panelMutationAfterCrossover
				.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelMutationAfterCrossover.setBounds(184, 441, 312, 99);
		cc.add(panelMutationAfterCrossover);
		panelMutationAfterCrossover.setLayout(new BorderLayout(0, 0));

		panelFitnessEvaluation = new JPanel();
		panelFitnessEvaluation.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelFitnessEvaluation.setBounds(1319, 167, 128, 79);
		cc.add(panelFitnessEvaluation);
		panelFitnessEvaluation.setLayout(new BorderLayout(0, 0));

		panel_26 = new JPanel();
		panel_26.setBorder(new EmptyBorder(5, 5, 5, 5));
		panelFitnessEvaluation.add(panel_26, BorderLayout.CENTER);
		GridBagLayout gbl_panel_26 = new GridBagLayout();
		gbl_panel_26.columnWidths = new int[] { 0, 0 };
		gbl_panel_26.rowHeights = new int[] { 0, 0, 0 };
		gbl_panel_26.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
		gbl_panel_26.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
		panel_26.setLayout(gbl_panel_26);

		lblFitnessEvaluation = new JLabel(
				"<html><p align=center>Fitness<br>Evaluation</p></html>");
		GridBagConstraints gbc_lblFitnessEvaluation = new GridBagConstraints();
		gbc_lblFitnessEvaluation.insets = new Insets(0, 0, 5, 0);
		gbc_lblFitnessEvaluation.gridx = 0;
		gbc_lblFitnessEvaluation.gridy = 0;
		panel_26.add(lblFitnessEvaluation, gbc_lblFitnessEvaluation);

		JButton btnSetFitnessFunction = new JButton("Set Function");
		btnSetFitnessFunction.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				tabbedPane.setSelectedComponent(panelFitness);
			}
		});
		GridBagConstraints gbc_btnSetFitnessFunction = new GridBagConstraints();
		gbc_btnSetFitnessFunction.fill = GridBagConstraints.HORIZONTAL;
		gbc_btnSetFitnessFunction.gridx = 0;
		gbc_btnSetFitnessFunction.gridy = 1;
		panel_26.add(btnSetFitnessFunction, gbc_btnSetFitnessFunction);

		connectors[0] = new JConnector(panelProbMutation, panelProbParamOnly,
				ConnectLine.LINE_ARROW_DEST,
				JConnector.CONNECT_LINE_TYPE_RECTANGULAR, Color.black,
				JConnector.RIGHT, JConnector.BOTTOM,
				ConnectLine.LINE_START_HORIZONTAL);
		connectors[1] = new JConnector(panelProbMutation, panelProbStructure,
				ConnectLine.LINE_ARROW_DEST,
				JConnector.CONNECT_LINE_TYPE_RECTANGULAR, Color.black,
				JConnector.RIGHT, JConnector.TOP,
				ConnectLine.LINE_START_HORIZONTAL);
		connectors[2] = new JConnector(panelProbParamOnly, panelParamInside,
				ConnectLine.LINE_ARROW_DEST,
				JConnector.CONNECT_LINE_TYPE_RECTANGULAR, Color.black);
		connectors[3] = new JConnector(panelProbStructure,
				panelStructureInside, ConnectLine.LINE_ARROW_DEST,
				JConnector.CONNECT_LINE_TYPE_RECTANGULAR, Color.black);
		connectors[4] = new JConnector(panelProbCrossover,
				panelCrossoverInside, ConnectLine.LINE_ARROW_DEST,
				JConnector.CONNECT_LINE_TYPE_RECTANGULAR, Color.black);
		connectors[5] = new JConnector(panelCrossoverInside,
				panelMutationAfterCrossover, ConnectLine.LINE_ARROW_DEST,
				JConnector.CONNECT_LINE_TYPE_RECTANGULAR, Color.black);
		connectors[6] = new JConnector(panelMutationAfterCrossover,
				panelProbMutation, ConnectLine.LINE_ARROW_DEST,
				JConnector.CONNECT_LINE_TYPE_RECTANGULAR, Color.black);
		connectors[7] = new JConnector(panelParamInside, panelSpeciation,
				ConnectLine.LINE_ARROW_DEST,
				JConnector.CONNECT_LINE_TYPE_RECTANGULAR, Color.black);
		connectors[8] = new JConnector(panelStructureInside, panelSpeciation,
				ConnectLine.LINE_ARROW_DEST,
				JConnector.CONNECT_LINE_TYPE_RECTANGULAR, Color.black);
		connectors[9] = new JConnector(panelMutationAfterCrossover,
				panelSpeciation, ConnectLine.LINE_ARROW_DEST,
				JConnector.CONNECT_LINE_TYPE_RECTANGULAR, Color.black,
				JConnector.RIGHT, JConnector.BOTTOM,
				ConnectLine.LINE_START_HORIZONTAL);
		connectors[10] = new JConnector(panelSpeciation,
				panelFitnessEvaluation, ConnectLine.LINE_ARROW_DEST,
				JConnector.CONNECT_LINE_TYPE_RECTANGULAR, Color.black);

		panel_46 = new JPanel();
		panelMutationAfterCrossover.add(panel_46, BorderLayout.CENTER);
		panel_46.setBorder(new EmptyBorder(5, 5, 5, 5));
		GridBagLayout gbl_panel_46 = new GridBagLayout();
		gbl_panel_46.columnWidths = new int[] { 0, 0 };
		gbl_panel_46.rowHeights = new int[] { 0, 0, 0, 0 };
		gbl_panel_46.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
		gbl_panel_46.rowWeights = new double[] { 0.0, 0.0, 0.0,
				Double.MIN_VALUE };
		panel_46.setLayout(gbl_panel_46);

		JLabel lblMutationAfter = new JLabel("% Mutation after Crossover");
		GridBagConstraints gbc_lblMutationAfter = new GridBagConstraints();
		gbc_lblMutationAfter.insets = new Insets(0, 0, 5, 0);
		gbc_lblMutationAfter.gridx = 0;
		gbc_lblMutationAfter.gridy = 0;
		panel_46.add(lblMutationAfter, gbc_lblMutationAfter);
		slMutaAftCross = new JSlider();
		GridBagConstraints gbc_slMutaAftCross = new GridBagConstraints();
		gbc_slMutaAftCross.fill = GridBagConstraints.HORIZONTAL;
		gbc_slMutaAftCross.insets = new Insets(0, 0, 5, 0);
		gbc_slMutaAftCross.gridx = 0;
		gbc_slMutaAftCross.gridy = 1;
		panel_46.add(slMutaAftCross, gbc_slMutaAftCross);
		tfMutaAftCross = new JTextField();
		GridBagConstraints gbc_tfMutaAftCross = new GridBagConstraints();
		gbc_tfMutaAftCross.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfMutaAftCross.gridx = 0;
		gbc_tfMutaAftCross.gridy = 2;
		panel_46.add(tfMutaAftCross, gbc_tfMutaAftCross);
		tfMutaAftCross.setInputVerifier(new ProbInputVerifier());
		tfMutaAftCross.setColumns(10);
		tfMutaAftCross.addFocusListener(new MyFocusListener(slMutaAftCross));
		slMutaAftCross.addChangeListener(new MyChangeListener(tfMutaAftCross));

		JPanel panel_5 = new JPanel();
		tabbedPane.addTab("Model", null, panel_5, null);
		panel_5.setLayout(null);

		lblAssociationSpeedkduplex = new JLabel("Association speed (Kduplex)");
		lblAssociationSpeedkduplex.setBounds(636, 17, 180, 14);
		panel_5.add(lblAssociationSpeedkduplex);

		tfKduplex = new JTextField();
		tfKduplex.setInputVerifier(new DoubleInputVerifier());
		tfKduplex.setColumns(10);
		tfKduplex.setBounds(831, 14, 90, 20);
		panel_5.add(tfKduplex);

		panel_6 = new JPanel();
		panel_6.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_6.setBounds(10, 14, 616, 183);
		panel_5.add(panel_6);
		panel_6.setLayout(new BorderLayout(0, 0));

		panel_28 = new JPanel();
		panel_6.add(panel_28, BorderLayout.CENTER);
		panel_28.setBorder(new EmptyBorder(10, 10, 10, 10));
		GridBagLayout gbl_panel_28 = new GridBagLayout();
		gbl_panel_28.columnWidths = new int[] { 0, 0, 0 };
		gbl_panel_28.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0 };
		gbl_panel_28.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
		gbl_panel_28.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
				Double.MIN_VALUE };
		panel_28.setLayout(gbl_panel_28);

		JLabel lblSaturationAndCoupling = new JLabel("Saturation and Coupling");
		GridBagConstraints gbc_lblSaturationAndCoupling = new GridBagConstraints();
		gbc_lblSaturationAndCoupling.anchor = GridBagConstraints.WEST;
		gbc_lblSaturationAndCoupling.insets = new Insets(0, 0, 5, 5);
		gbc_lblSaturationAndCoupling.gridx = 0;
		gbc_lblSaturationAndCoupling.gridy = 0;
		panel_28.add(lblSaturationAndCoupling, gbc_lblSaturationAndCoupling);

		cbExoSaturate = new JCheckBox("Exonuclease Saturation");
		GridBagConstraints gbc_cbExoSaturate = new GridBagConstraints();
		gbc_cbExoSaturate.insets = new Insets(0, 0, 5, 5);
		gbc_cbExoSaturate.anchor = GridBagConstraints.WEST;
		gbc_cbExoSaturate.gridx = 0;
		gbc_cbExoSaturate.gridy = 1;
		panel_28.add(cbExoSaturate, gbc_cbExoSaturate);

		cbExoCoupling = new JCheckBox("Exonuclease Coupling");
		GridBagConstraints gbc_cbExoCoupling = new GridBagConstraints();
		gbc_cbExoCoupling.anchor = GridBagConstraints.WEST;
		gbc_cbExoCoupling.insets = new Insets(0, 0, 5, 0);
		gbc_cbExoCoupling.gridx = 1;
		gbc_cbExoCoupling.gridy = 1;
		panel_28.add(cbExoCoupling, gbc_cbExoCoupling);

		cbPolySaturate = new JCheckBox("Polymerase Saturation");
		GridBagConstraints gbc_cbPolySaturate = new GridBagConstraints();
		gbc_cbPolySaturate.anchor = GridBagConstraints.WEST;
		gbc_cbPolySaturate.insets = new Insets(0, 0, 5, 5);
		gbc_cbPolySaturate.gridx = 0;
		gbc_cbPolySaturate.gridy = 2;
		panel_28.add(cbPolySaturate, gbc_cbPolySaturate);
		cbPolySaturate.addChangeListener(new ChangeListener() {
			@Override
			public void stateChanged(ChangeEvent e) {
				JCheckBox cb = (JCheckBox) e.getSource();
				if (cb.isSelected()) {
					cbPolyCoupling.setEnabled(true);
				} else {
					cbPolyCoupling.setEnabled(false);
				}
			}
		});

		cbPolyCoupling = new JCheckBox("Polymerase Coupling");
		GridBagConstraints gbc_cbPolyCoupling = new GridBagConstraints();
		gbc_cbPolyCoupling.anchor = GridBagConstraints.WEST;
		gbc_cbPolyCoupling.insets = new Insets(0, 0, 5, 0);
		gbc_cbPolyCoupling.gridx = 1;
		gbc_cbPolyCoupling.gridy = 2;
		panel_28.add(cbPolyCoupling, gbc_cbPolyCoupling);

		cbNickSaturate = new JCheckBox("Nicking Saturation");
		GridBagConstraints gbc_cbNickSaturate = new GridBagConstraints();
		gbc_cbNickSaturate.anchor = GridBagConstraints.WEST;
		gbc_cbNickSaturate.insets = new Insets(0, 0, 5, 5);
		gbc_cbNickSaturate.gridx = 0;
		gbc_cbNickSaturate.gridy = 3;
		panel_28.add(cbNickSaturate, gbc_cbNickSaturate);
		cbNickSaturate.addChangeListener(new ChangeListener() {
			@Override
			public void stateChanged(ChangeEvent e) {
				JCheckBox cb = (JCheckBox) e.getSource();
				if (cb.isSelected()) {
					cbNickCoupling.setEnabled(true);
				} else {
					cbNickCoupling.setEnabled(false);
				}
			}
		});

		cbNickCoupling = new JCheckBox("Nicking Coupling");
		GridBagConstraints gbc_cbNickCoupling = new GridBagConstraints();
		gbc_cbNickCoupling.anchor = GridBagConstraints.WEST;
		gbc_cbNickCoupling.insets = new Insets(0, 0, 5, 0);
		gbc_cbNickCoupling.gridx = 1;
		gbc_cbNickCoupling.gridy = 3;
		panel_28.add(cbNickCoupling, gbc_cbNickCoupling);

		cbExoSaturateByFreeTemplates = new JCheckBox(
				"Exonuclease Saturation By Free Templates");
		GridBagConstraints gbc_cbExoSaturateByFreeTemplates = new GridBagConstraints();
		gbc_cbExoSaturateByFreeTemplates.anchor = GridBagConstraints.WEST;
		gbc_cbExoSaturateByFreeTemplates.gridwidth = 2;
		gbc_cbExoSaturateByFreeTemplates.insets = new Insets(0, 0, 5, 0);
		gbc_cbExoSaturateByFreeTemplates.gridx = 0;
		gbc_cbExoSaturateByFreeTemplates.gridy = 4;
		panel_28.add(cbExoSaturateByFreeTemplates,
				gbc_cbExoSaturateByFreeTemplates);

		cbExoSaturationByTemplatesAll = new JCheckBox(
				"Exonuclease Saturation By All Templates");
		cbExoSaturationByTemplatesAll.setSelected(true);
		GridBagConstraints gbc_cbExoSaturationByTemplatesAll = new GridBagConstraints();
		gbc_cbExoSaturationByTemplatesAll.anchor = GridBagConstraints.WEST;
		gbc_cbExoSaturationByTemplatesAll.gridwidth = 2;
		gbc_cbExoSaturationByTemplatesAll.insets = new Insets(0, 0, 0, 5);
		gbc_cbExoSaturationByTemplatesAll.gridx = 0;
		gbc_cbExoSaturationByTemplatesAll.gridy = 5;
		panel_28.add(cbExoSaturationByTemplatesAll,
				gbc_cbExoSaturationByTemplatesAll);

		panel_29 = new JPanel();
		panel_29.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_29.setBounds(10, 208, 616, 404);
		panel_5.add(panel_29);
		panel_29.setLayout(new BorderLayout(0, 0));

		panel_30 = new JPanel();
		panel_30.setBorder(new EmptyBorder(10, 10, 10, 10));
		panel_29.add(panel_30, BorderLayout.CENTER);
		GridBagLayout gbl_panel_30 = new GridBagLayout();
		gbl_panel_30.columnWidths = new int[] { 0, 0, 0, 0, 0 };
		gbl_panel_30.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
		gbl_panel_30.columnWeights = new double[] { 0.0, 0.0, 0.0, 1.0,
				Double.MIN_VALUE };
		gbl_panel_30.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
				0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
		panel_30.setLayout(gbl_panel_30);

		lblMichaelismentenParameters = new JLabel(
				"Michaelis-Menten parameters:");
		GridBagConstraints gbc_lblMichaelismentenParameters = new GridBagConstraints();
		gbc_lblMichaelismentenParameters.anchor = GridBagConstraints.WEST;
		gbc_lblMichaelismentenParameters.insets = new Insets(0, 0, 5, 5);
		gbc_lblMichaelismentenParameters.gridx = 0;
		gbc_lblMichaelismentenParameters.gridy = 0;
		panel_30.add(lblMichaelismentenParameters,
				gbc_lblMichaelismentenParameters);

		lblExovm = new JLabel("exoVm?");
		GridBagConstraints gbc_lblExovm = new GridBagConstraints();
		gbc_lblExovm.anchor = GridBagConstraints.WEST;
		gbc_lblExovm.gridwidth = 3;
		gbc_lblExovm.insets = new Insets(0, 0, 5, 5);
		gbc_lblExovm.gridx = 0;
		gbc_lblExovm.gridy = 1;
		panel_30.add(lblExovm, gbc_lblExovm);

		tfExoVm = new JTextField();
		GridBagConstraints gbc_tfExoVm = new GridBagConstraints();
		gbc_tfExoVm.weightx = 0.5;
		gbc_tfExoVm.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfExoVm.insets = new Insets(0, 0, 5, 0);
		gbc_tfExoVm.gridx = 3;
		gbc_tfExoVm.gridy = 1;
		panel_30.add(tfExoVm, gbc_tfExoVm);
		tfExoVm.setInputVerifier(new DoubleInputVerifier());
		tfExoVm.setColumns(10);

		lblForSimpleSequence = new JLabel("For Simple Sequence (exoKmSimple)");
		GridBagConstraints gbc_lblForSimpleSequence = new GridBagConstraints();
		gbc_lblForSimpleSequence.anchor = GridBagConstraints.WEST;
		gbc_lblForSimpleSequence.gridwidth = 3;
		gbc_lblForSimpleSequence.insets = new Insets(0, 0, 5, 5);
		gbc_lblForSimpleSequence.gridx = 0;
		gbc_lblForSimpleSequence.gridy = 2;
		panel_30.add(lblForSimpleSequence, gbc_lblForSimpleSequence);

		tfExoKmSimple = new JTextField();
		GridBagConstraints gbc_tfExoKmSimple = new GridBagConstraints();
		gbc_tfExoKmSimple.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfExoKmSimple.insets = new Insets(0, 0, 5, 0);
		gbc_tfExoKmSimple.gridx = 3;
		gbc_tfExoKmSimple.gridy = 2;
		panel_30.add(tfExoKmSimple, gbc_tfExoKmSimple);
		tfExoKmSimple.setInputVerifier(new DoubleInputVerifier());
		tfExoKmSimple.setColumns(10);

		lblForInhibitingSequences = new JLabel(
				"For Inhibiting Sequence (exoKmInhib)");
		GridBagConstraints gbc_lblForInhibitingSequences = new GridBagConstraints();
		gbc_lblForInhibitingSequences.anchor = GridBagConstraints.WEST;
		gbc_lblForInhibitingSequences.gridwidth = 3;
		gbc_lblForInhibitingSequences.insets = new Insets(0, 0, 5, 5);
		gbc_lblForInhibitingSequences.gridx = 0;
		gbc_lblForInhibitingSequences.gridy = 3;
		panel_30.add(lblForInhibitingSequences, gbc_lblForInhibitingSequences);

		tfExoKmInhib = new JTextField();
		GridBagConstraints gbc_tfExoKmInhib = new GridBagConstraints();
		gbc_tfExoKmInhib.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfExoKmInhib.insets = new Insets(0, 0, 5, 0);
		gbc_tfExoKmInhib.gridx = 3;
		gbc_tfExoKmInhib.gridy = 3;
		panel_30.add(tfExoKmInhib, gbc_tfExoKmInhib);
		tfExoKmInhib.setInputVerifier(new DoubleInputVerifier());
		tfExoKmInhib.setColumns(10);

		lblExonucleaseSaturationBy = new JLabel(
				"Exonuclease saturation by free templates (exoKmTemplate)");
		GridBagConstraints gbc_lblExonucleaseSaturationBy = new GridBagConstraints();
		gbc_lblExonucleaseSaturationBy.anchor = GridBagConstraints.WEST;
		gbc_lblExonucleaseSaturationBy.gridwidth = 3;
		gbc_lblExonucleaseSaturationBy.insets = new Insets(0, 0, 5, 5);
		gbc_lblExonucleaseSaturationBy.gridx = 0;
		gbc_lblExonucleaseSaturationBy.gridy = 4;
		panel_30.add(lblExonucleaseSaturationBy, gbc_lblExonucleaseSaturationBy);

		tfExoKmTemplate = new JTextField();
		GridBagConstraints gbc_tfExoKmTemplate = new GridBagConstraints();
		gbc_tfExoKmTemplate.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfExoKmTemplate.insets = new Insets(0, 0, 5, 0);
		gbc_tfExoKmTemplate.gridx = 3;
		gbc_tfExoKmTemplate.gridy = 4;
		panel_30.add(tfExoKmTemplate, gbc_tfExoKmTemplate);
		tfExoKmTemplate.setInputVerifier(new DoubleInputVerifier());
		tfExoKmTemplate.setColumns(10);

		lblPolvm = new JLabel("polVm?");
		GridBagConstraints gbc_lblPolvm = new GridBagConstraints();
		gbc_lblPolvm.anchor = GridBagConstraints.WEST;
		gbc_lblPolvm.insets = new Insets(0, 0, 5, 5);
		gbc_lblPolvm.gridx = 0;
		gbc_lblPolvm.gridy = 5;
		panel_30.add(lblPolvm, gbc_lblPolvm);

		tfPolVm = new JTextField();
		GridBagConstraints gbc_tfPolVm = new GridBagConstraints();
		gbc_tfPolVm.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfPolVm.weightx = 0.5;
		gbc_tfPolVm.insets = new Insets(0, 0, 5, 5);
		gbc_tfPolVm.gridx = 1;
		gbc_tfPolVm.gridy = 5;
		panel_30.add(tfPolVm, gbc_tfPolVm);
		tfPolVm.setInputVerifier(new DoubleInputVerifier());
		tfPolVm.setColumns(10);

		lblPolkm = new JLabel("polKm?");
		GridBagConstraints gbc_lblPolkm = new GridBagConstraints();
		gbc_lblPolkm.anchor = GridBagConstraints.WEST;
		gbc_lblPolkm.insets = new Insets(0, 0, 5, 5);
		gbc_lblPolkm.gridx = 2;
		gbc_lblPolkm.gridy = 5;
		panel_30.add(lblPolkm, gbc_lblPolkm);

		tfPolKm = new JTextField();
		GridBagConstraints gbc_tfPolKm = new GridBagConstraints();
		gbc_tfPolKm.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfPolKm.insets = new Insets(0, 0, 5, 0);
		gbc_tfPolKm.gridx = 3;
		gbc_tfPolKm.gridy = 5;
		panel_30.add(tfPolKm, gbc_tfPolKm);
		tfPolKm.setInputVerifier(new DoubleInputVerifier());
		tfPolKm.setColumns(10);

		lblPolkmboth = new JLabel("polKmBoth?");
		GridBagConstraints gbc_lblPolkmboth = new GridBagConstraints();
		gbc_lblPolkmboth.anchor = GridBagConstraints.WEST;
		gbc_lblPolkmboth.insets = new Insets(0, 0, 5, 5);
		gbc_lblPolkmboth.gridx = 0;
		gbc_lblPolkmboth.gridy = 6;
		panel_30.add(lblPolkmboth, gbc_lblPolkmboth);

		tfPolKmBoth = new JTextField();
		GridBagConstraints gbc_tfPolKmBoth = new GridBagConstraints();
		gbc_tfPolKmBoth.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfPolKmBoth.insets = new Insets(0, 0, 5, 5);
		gbc_tfPolKmBoth.gridx = 1;
		gbc_tfPolKmBoth.gridy = 6;
		panel_30.add(tfPolKmBoth, gbc_tfPolKmBoth);
		tfPolKmBoth.setInputVerifier(new DoubleInputVerifier());
		tfPolKmBoth.setColumns(10);

		lblNickvm = new JLabel("nickVm?");
		GridBagConstraints gbc_lblNickvm = new GridBagConstraints();
		gbc_lblNickvm.anchor = GridBagConstraints.WEST;
		gbc_lblNickvm.insets = new Insets(0, 0, 5, 5);
		gbc_lblNickvm.gridx = 2;
		gbc_lblNickvm.gridy = 6;
		panel_30.add(lblNickvm, gbc_lblNickvm);

		tfNickVm = new JTextField();
		GridBagConstraints gbc_tfNickVm = new GridBagConstraints();
		gbc_tfNickVm.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfNickVm.insets = new Insets(0, 0, 5, 0);
		gbc_tfNickVm.gridx = 3;
		gbc_tfNickVm.gridy = 6;
		panel_30.add(tfNickVm, gbc_tfNickVm);
		tfNickVm.setInputVerifier(new DoubleInputVerifier());
		tfNickVm.setColumns(10);

		lblNickkm = new JLabel("nickKm?");
		GridBagConstraints gbc_lblNickkm = new GridBagConstraints();
		gbc_lblNickkm.anchor = GridBagConstraints.WEST;
		gbc_lblNickkm.insets = new Insets(0, 0, 5, 5);
		gbc_lblNickkm.gridx = 0;
		gbc_lblNickkm.gridy = 7;
		panel_30.add(lblNickkm, gbc_lblNickkm);

		tfNickKm = new JTextField();
		GridBagConstraints gbc_tfNickKm = new GridBagConstraints();
		gbc_tfNickKm.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfNickKm.insets = new Insets(0, 0, 5, 5);
		gbc_tfNickKm.gridx = 1;
		gbc_tfNickKm.gridy = 7;
		panel_30.add(tfNickKm, gbc_tfNickKm);
		tfNickKm.setInputVerifier(new DoubleInputVerifier());
		tfNickKm.setColumns(10);

		lblLeakRatio = new JLabel("Leak Ratio");
		GridBagConstraints gbc_lblLeakRatio = new GridBagConstraints();
		gbc_lblLeakRatio.anchor = GridBagConstraints.WEST;
		gbc_lblLeakRatio.insets = new Insets(0, 0, 5, 5);
		gbc_lblLeakRatio.gridx = 2;
		gbc_lblLeakRatio.gridy = 7;
		panel_30.add(lblLeakRatio, gbc_lblLeakRatio);
		lblLeakRatio
				.setToolTipText("Factor to the polymerase activity to take into account the probability that the polymerase will generate an output from a free template");

		tfLeakRatio = new JTextField();
		GridBagConstraints gbc_tfLeakRatio = new GridBagConstraints();
		gbc_tfLeakRatio.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfLeakRatio.insets = new Insets(0, 0, 5, 0);
		gbc_tfLeakRatio.gridx = 3;
		gbc_tfLeakRatio.gridy = 7;
		panel_30.add(tfLeakRatio, gbc_tfLeakRatio);
		tfLeakRatio.setInputVerifier(new DoubleInputVerifier());
		tfLeakRatio.setColumns(10);

		lblRatioInhibition = new JLabel("Ratio Inhibition");
		GridBagConstraints gbc_lblRatioInhibition = new GridBagConstraints();
		gbc_lblRatioInhibition.anchor = GridBagConstraints.WEST;
		gbc_lblRatioInhibition.insets = new Insets(0, 0, 5, 5);
		gbc_lblRatioInhibition.gridx = 0;
		gbc_lblRatioInhibition.gridy = 8;
		panel_30.add(lblRatioInhibition, gbc_lblRatioInhibition);
		lblRatioInhibition
				.setToolTipText("Factor between an inhibitior K and inhK");

		tfRatioInhib = new JTextField();
		GridBagConstraints gbc_tfRatioInhib = new GridBagConstraints();
		gbc_tfRatioInhib.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfRatioInhib.insets = new Insets(0, 0, 5, 5);
		gbc_tfRatioInhib.gridx = 1;
		gbc_tfRatioInhib.gridy = 8;
		panel_30.add(tfRatioInhib, gbc_tfRatioInhib);
		tfRatioInhib.setInputVerifier(new DoubleInputVerifier());
		tfRatioInhib.setColumns(10);

		lblRefactorToehold = new JLabel("Toehold Left");
		GridBagConstraints gbc_lblRefactorToehold = new GridBagConstraints();
		gbc_lblRefactorToehold.anchor = GridBagConstraints.WEST;
		gbc_lblRefactorToehold.insets = new Insets(0, 0, 5, 5);
		gbc_lblRefactorToehold.gridx = 2;
		gbc_lblRefactorToehold.gridy = 8;
		panel_30.add(lblRefactorToehold, gbc_lblRefactorToehold);
		lblRefactorToehold
				.setToolTipText("Factor to the association speed for an input and output to displace an inhibitor");

		tfToeholdLeft = new JTextField();
		GridBagConstraints gbc_tfToeholdLeft = new GridBagConstraints();
		gbc_tfToeholdLeft.insets = new Insets(0, 0, 5, 0);
		gbc_tfToeholdLeft.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfToeholdLeft.gridx = 3;
		gbc_tfToeholdLeft.gridy = 8;
		panel_30.add(tfToeholdLeft, gbc_tfToeholdLeft);
		tfToeholdLeft.setInputVerifier(new DoubleInputVerifier());
		tfToeholdLeft.setColumns(10);

		lblToeholdRight = new JLabel("Toehold Right");
		lblToeholdRight
				.setToolTipText("Factor to the association speed for an input and output to displace an inhibitor");
		GridBagConstraints gbc_lblToeholdRight = new GridBagConstraints();
		gbc_lblToeholdRight.anchor = GridBagConstraints.EAST;
		gbc_lblToeholdRight.insets = new Insets(0, 0, 0, 5);
		gbc_lblToeholdRight.gridx = 2;
		gbc_lblToeholdRight.gridy = 9;
		panel_30.add(lblToeholdRight, gbc_lblToeholdRight);

		tfToeholdRight = new JTextField();
		tfToeholdRight.setText((String) null);
		tfToeholdRight.setColumns(10);
		GridBagConstraints gbc_tfToeholdRight = new GridBagConstraints();
		gbc_tfToeholdRight.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfToeholdRight.gridx = 3;
		gbc_tfToeholdRight.gridy = 9;
		panel_30.add(tfToeholdRight, gbc_tfToeholdRight);
		tfToeholdRight.setInputVerifier(new DoubleInputVerifier());
		tfToeholdRight.setColumns(10);

		panel_8 = new JPanel();
		panel_8.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_8.setBounds(636, 42, 478, 232);
		panel_5.add(panel_8);
		panel_8.setLayout(new BorderLayout(0, 0));

		panel_31 = new JPanel();
		panel_8.add(panel_31, BorderLayout.CENTER);
		panel_31.setBorder(new EmptyBorder(10, 10, 10, 10));
		GridBagLayout gbl_panel_31 = new GridBagLayout();
		gbl_panel_31.columnWidths = new int[] { 0, 0, 0 };
		gbl_panel_31.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
		gbl_panel_31.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
		gbl_panel_31.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
				0.0, Double.MIN_VALUE };
		panel_31.setLayout(gbl_panel_31);

		lblSimpleModelConstans = new JLabel("Simple model constans:");
		GridBagConstraints gbc_lblSimpleModelConstans = new GridBagConstraints();
		gbc_lblSimpleModelConstans.anchor = GridBagConstraints.WEST;
		gbc_lblSimpleModelConstans.insets = new Insets(0, 0, 5, 5);
		gbc_lblSimpleModelConstans.gridx = 0;
		gbc_lblSimpleModelConstans.gridy = 0;
		panel_31.add(lblSimpleModelConstans, gbc_lblSimpleModelConstans);

		lblNickaseActivityn = new JLabel("Nickase Activity (n)");
		GridBagConstraints gbc_lblNickaseActivityn = new GridBagConstraints();
		gbc_lblNickaseActivityn.anchor = GridBagConstraints.WEST;
		gbc_lblNickaseActivityn.insets = new Insets(0, 0, 5, 5);
		gbc_lblNickaseActivityn.gridx = 0;
		gbc_lblNickaseActivityn.gridy = 1;
		panel_31.add(lblNickaseActivityn, gbc_lblNickaseActivityn);

		tfNickAct = new JTextField();
		GridBagConstraints gbc_tfNickAct = new GridBagConstraints();
		gbc_tfNickAct.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfNickAct.weightx = 0.5;
		gbc_tfNickAct.insets = new Insets(0, 0, 5, 0);
		gbc_tfNickAct.gridx = 1;
		gbc_tfNickAct.gridy = 1;
		panel_31.add(tfNickAct, gbc_tfNickAct);
		tfNickAct.setInputVerifier(new DoubleInputVerifier());
		tfNickAct.setColumns(10);

		lblPolymeraseActivityp = new JLabel("Polymerase Activity (p)");
		GridBagConstraints gbc_lblPolymeraseActivityp = new GridBagConstraints();
		gbc_lblPolymeraseActivityp.anchor = GridBagConstraints.WEST;
		gbc_lblPolymeraseActivityp.insets = new Insets(0, 0, 5, 5);
		gbc_lblPolymeraseActivityp.gridx = 0;
		gbc_lblPolymeraseActivityp.gridy = 2;
		panel_31.add(lblPolymeraseActivityp, gbc_lblPolymeraseActivityp);

		tfPolyAct = new JTextField();
		GridBagConstraints gbc_tfPolyAct = new GridBagConstraints();
		gbc_tfPolyAct.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfPolyAct.insets = new Insets(0, 0, 5, 0);
		gbc_tfPolyAct.gridx = 1;
		gbc_tfPolyAct.gridy = 2;
		panel_31.add(tfPolyAct, gbc_tfPolyAct);
		tfPolyAct.setInputVerifier(new DoubleInputVerifier());
		tfPolyAct.setColumns(10);

		lblInhibitionFactorOf = new JLabel(
				"Inhibition Factor of Templates (lembda)");
		GridBagConstraints gbc_lblInhibitionFactorOf = new GridBagConstraints();
		gbc_lblInhibitionFactorOf.anchor = GridBagConstraints.WEST;
		gbc_lblInhibitionFactorOf.insets = new Insets(0, 0, 5, 5);
		gbc_lblInhibitionFactorOf.gridx = 0;
		gbc_lblInhibitionFactorOf.gridy = 3;
		panel_31.add(lblInhibitionFactorOf, gbc_lblInhibitionFactorOf);

		tfLembda = new JTextField();
		GridBagConstraints gbc_tfLembda = new GridBagConstraints();
		gbc_tfLembda.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfLembda.insets = new Insets(0, 0, 5, 0);
		gbc_tfLembda.gridx = 1;
		gbc_tfLembda.gridy = 3;
		panel_31.add(tfLembda, gbc_tfLembda);
		tfLembda.setInputVerifier(new DoubleInputVerifier());
		tfLembda.setColumns(10);

		lblExonucleaseActivityexo = new JLabel("Exonuclease Activity (exo)");
		GridBagConstraints gbc_lblExonucleaseActivityexo = new GridBagConstraints();
		gbc_lblExonucleaseActivityexo.anchor = GridBagConstraints.WEST;
		gbc_lblExonucleaseActivityexo.insets = new Insets(0, 0, 5, 5);
		gbc_lblExonucleaseActivityexo.gridx = 0;
		gbc_lblExonucleaseActivityexo.gridy = 4;
		panel_31.add(lblExonucleaseActivityexo, gbc_lblExonucleaseActivityexo);

		tfExoAct = new JTextField();
		GridBagConstraints gbc_tfExoAct = new GridBagConstraints();
		gbc_tfExoAct.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfExoAct.insets = new Insets(0, 0, 5, 0);
		gbc_tfExoAct.gridx = 1;
		gbc_tfExoAct.gridy = 4;
		panel_31.add(tfExoAct, gbc_tfExoAct);
		tfExoAct.setInputVerifier(new DoubleInputVerifier());
		tfExoAct.setColumns(10);

		lblExonucleaseActivityWith = new JLabel(
				"Exonuclease Activity with Inhibition (exoInhib)");
		GridBagConstraints gbc_lblExonucleaseActivityWith = new GridBagConstraints();
		gbc_lblExonucleaseActivityWith.anchor = GridBagConstraints.WEST;
		gbc_lblExonucleaseActivityWith.insets = new Insets(0, 0, 5, 5);
		gbc_lblExonucleaseActivityWith.gridx = 0;
		gbc_lblExonucleaseActivityWith.gridy = 5;
		panel_31.add(lblExonucleaseActivityWith, gbc_lblExonucleaseActivityWith);

		tfExoInhib = new JTextField();
		GridBagConstraints gbc_tfExoInhib = new GridBagConstraints();
		gbc_tfExoInhib.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfExoInhib.insets = new Insets(0, 0, 5, 0);
		gbc_tfExoInhib.gridx = 1;
		gbc_tfExoInhib.gridy = 5;
		panel_31.add(tfExoInhib, gbc_tfExoInhib);
		tfExoInhib.setInputVerifier(new DoubleInputVerifier());
		tfExoInhib.setColumns(10);

		lblNewLabel = new JLabel("Displacement Slowdown (displ)");
		GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
		gbc_lblNewLabel.anchor = GridBagConstraints.WEST;
		gbc_lblNewLabel.insets = new Insets(0, 0, 0, 5);
		gbc_lblNewLabel.gridx = 0;
		gbc_lblNewLabel.gridy = 6;
		panel_31.add(lblNewLabel, gbc_lblNewLabel);
		lblNewLabel
				.setToolTipText("Displacement slowdown when displacing an output that is an inhibiting sequence");

		tfDispl = new JTextField();
		GridBagConstraints gbc_tfDispl = new GridBagConstraints();
		gbc_tfDispl.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfDispl.gridx = 1;
		gbc_tfDispl.gridy = 6;
		panel_31.add(tfDispl, gbc_tfDispl);
		tfDispl.setInputVerifier(new DoubleInputVerifier());
		tfDispl.setColumns(10);

		panel_7 = new JPanel();
		panel_7.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_7.setBounds(636, 285, 478, 297);
		panel_5.add(panel_7);
		panel_7.setLayout(new BorderLayout(0, 0));

		panel_32 = new JPanel();
		panel_7.add(panel_32, BorderLayout.CENTER);
		panel_32.setBorder(new EmptyBorder(10, 10, 10, 10));
		GridBagLayout gbl_panel_32 = new GridBagLayout();
		gbl_panel_32.columnWidths = new int[] { 0, 0, 0 };
		gbl_panel_32.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
		gbl_panel_32.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
		gbl_panel_32.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
				0.0, 0.0, 0.0, Double.MIN_VALUE };
		panel_32.setLayout(gbl_panel_32);

		lblSolverParameters = new JLabel("Solver Parameters:");
		GridBagConstraints gbc_lblSolverParameters = new GridBagConstraints();
		gbc_lblSolverParameters.insets = new Insets(0, 0, 5, 5);
		gbc_lblSolverParameters.gridx = 0;
		gbc_lblSolverParameters.gridy = 0;
		panel_32.add(lblSolverParameters, gbc_lblSolverParameters);

		lblNewLabel_1 = new JLabel("Number of points");
		GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints();
		gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5);
		gbc_lblNewLabel_1.gridx = 0;
		gbc_lblNewLabel_1.gridy = 1;
		panel_32.add(lblNewLabel_1, gbc_lblNewLabel_1);

		tfNPoints = new JTextField();
		GridBagConstraints gbc_tfNPoints = new GridBagConstraints();
		gbc_tfNPoints.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfNPoints.weightx = 0.5;
		gbc_tfNPoints.insets = new Insets(0, 0, 5, 0);
		gbc_tfNPoints.gridx = 1;
		gbc_tfNPoints.gridy = 1;
		panel_32.add(tfNPoints, gbc_tfNPoints);
		tfNPoints.setInputVerifier(new IntInputVerifier());
		tfNPoints.setColumns(10);

		lblMaxTimecomplex = new JLabel("Max time (complex model)");
		GridBagConstraints gbc_lblMaxTimecomplex = new GridBagConstraints();
		gbc_lblMaxTimecomplex.insets = new Insets(0, 0, 5, 5);
		gbc_lblMaxTimecomplex.gridx = 0;
		gbc_lblMaxTimecomplex.gridy = 2;
		panel_32.add(lblMaxTimecomplex, gbc_lblMaxTimecomplex);

		tfMaxTimeComplex = new JTextField();
		GridBagConstraints gbc_tfMaxTimeComplex = new GridBagConstraints();
		gbc_tfMaxTimeComplex.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfMaxTimeComplex.insets = new Insets(0, 0, 5, 0);
		gbc_tfMaxTimeComplex.gridx = 1;
		gbc_tfMaxTimeComplex.gridy = 2;
		panel_32.add(tfMaxTimeComplex, gbc_tfMaxTimeComplex);
		tfMaxTimeComplex.setInputVerifier(new IntInputVerifier());
		tfMaxTimeComplex.setColumns(10);

		lblMaxTimesimple = new JLabel("Max time (simple model)");
		GridBagConstraints gbc_lblMaxTimesimple = new GridBagConstraints();
		gbc_lblMaxTimesimple.insets = new Insets(0, 0, 5, 5);
		gbc_lblMaxTimesimple.gridx = 0;
		gbc_lblMaxTimesimple.gridy = 3;
		panel_32.add(lblMaxTimesimple, gbc_lblMaxTimesimple);

		tfMaxTimeSimple = new JTextField();
		GridBagConstraints gbc_tfMaxTimeSimple = new GridBagConstraints();
		gbc_tfMaxTimeSimple.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfMaxTimeSimple.insets = new Insets(0, 0, 5, 0);
		gbc_tfMaxTimeSimple.gridx = 1;
		gbc_tfMaxTimeSimple.gridy = 3;
		panel_32.add(tfMaxTimeSimple, gbc_tfMaxTimeSimple);
		tfMaxTimeSimple.setInputVerifier(new IntInputVerifier());
		tfMaxTimeSimple.setColumns(10);

		lblIntegrationAbsoluteError = new JLabel("Integration Absolute Error");
		GridBagConstraints gbc_lblIntegrationAbsoluteError = new GridBagConstraints();
		gbc_lblIntegrationAbsoluteError.insets = new Insets(0, 0, 5, 5);
		gbc_lblIntegrationAbsoluteError.gridx = 0;
		gbc_lblIntegrationAbsoluteError.gridy = 4;
		panel_32.add(lblIntegrationAbsoluteError,
				gbc_lblIntegrationAbsoluteError);

		tfIntegrationAbsError = new JTextField();
		GridBagConstraints gbc_tfIntegrationAbsError = new GridBagConstraints();
		gbc_tfIntegrationAbsError.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfIntegrationAbsError.insets = new Insets(0, 0, 5, 0);
		gbc_tfIntegrationAbsError.gridx = 1;
		gbc_tfIntegrationAbsError.gridy = 4;
		panel_32.add(tfIntegrationAbsError, gbc_tfIntegrationAbsError);
		tfIntegrationAbsError.setInputVerifier(new DoubleInputVerifier());
		tfIntegrationAbsError.setColumns(10);

		lblIntegrationRelativeError = new JLabel("Integration Relative Error");
		GridBagConstraints gbc_lblIntegrationRelativeError = new GridBagConstraints();
		gbc_lblIntegrationRelativeError.insets = new Insets(0, 0, 5, 5);
		gbc_lblIntegrationRelativeError.gridx = 0;
		gbc_lblIntegrationRelativeError.gridy = 5;
		panel_32.add(lblIntegrationRelativeError,
				gbc_lblIntegrationRelativeError);

		tfIntegrationRelError = new JTextField();
		GridBagConstraints gbc_tfIntegrationRelError = new GridBagConstraints();
		gbc_tfIntegrationRelError.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfIntegrationRelError.insets = new Insets(0, 0, 5, 0);
		gbc_tfIntegrationRelError.gridx = 1;
		gbc_tfIntegrationRelError.gridy = 5;
		panel_32.add(tfIntegrationRelError, gbc_tfIntegrationRelError);
		tfIntegrationRelError.setInputVerifier(new DoubleInputVerifier());
		tfIntegrationRelError.setColumns(10);

		JLabel lblChangeThresholdFor = new JLabel(
				"Threshold for Stability Detection");
		GridBagConstraints gbc_lblChangeThresholdFor = new GridBagConstraints();
		gbc_lblChangeThresholdFor.insets = new Insets(0, 0, 5, 5);
		gbc_lblChangeThresholdFor.gridx = 0;
		gbc_lblChangeThresholdFor.gridy = 6;
		panel_32.add(lblChangeThresholdFor, gbc_lblChangeThresholdFor);

		tfThresholdStable = new JTextField();
		GridBagConstraints gbc_tfThresholdStable = new GridBagConstraints();
		gbc_tfThresholdStable.insets = new Insets(0, 0, 5, 0);
		gbc_tfThresholdStable.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfThresholdStable.gridx = 1;
		gbc_tfThresholdStable.gridy = 6;
		panel_32.add(tfThresholdStable, gbc_tfThresholdStable);
		tfThresholdStable.setInputVerifier(new DoubleInputVerifier());
		tfThresholdStable.setColumns(10);

		lblMinTimeFor = new JLabel("Min Time for Stability Detection");
		GridBagConstraints gbc_lblMinTimeFor = new GridBagConstraints();
		gbc_lblMinTimeFor.anchor = GridBagConstraints.EAST;
		gbc_lblMinTimeFor.insets = new Insets(0, 0, 5, 5);
		gbc_lblMinTimeFor.gridx = 0;
		gbc_lblMinTimeFor.gridy = 7;
		panel_32.add(lblMinTimeFor, gbc_lblMinTimeFor);

		tfMinTimeStable = new JTextField();
		tfMinTimeStable.setText("0.005");
		tfMinTimeStable.setColumns(10);
		GridBagConstraints gbc_tfMinTimeStable = new GridBagConstraints();
		gbc_tfMinTimeStable.insets = new Insets(0, 0, 5, 0);
		gbc_tfMinTimeStable.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfMinTimeStable.gridx = 1;
		gbc_tfMinTimeStable.gridy = 7;
		panel_32.add(tfMinTimeStable, gbc_tfMinTimeStable);
		tfMinTimeStable.setInputVerifier(new IntInputVerifier());
		tfMinTimeStable.setColumns(10);

		lblMaxIntegrationSteps = new JLabel("Max integration steps");
		GridBagConstraints gbc_lblMaxIntegrationSteps = new GridBagConstraints();
		gbc_lblMaxIntegrationSteps.anchor = GridBagConstraints.EAST;
		gbc_lblMaxIntegrationSteps.insets = new Insets(0, 0, 0, 5);
		gbc_lblMaxIntegrationSteps.gridx = 0;
		gbc_lblMaxIntegrationSteps.gridy = 8;
		panel_32.add(lblMaxIntegrationSteps, gbc_lblMaxIntegrationSteps);

		tfMaxIntegrationSteps = new JTextField();
		tfMaxIntegrationSteps.setText("0.005");
		tfMaxIntegrationSteps.setColumns(10);
		GridBagConstraints gbc_tfMaxIntegrationSteps = new GridBagConstraints();
		gbc_tfMaxIntegrationSteps.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfMaxIntegrationSteps.gridx = 1;
		gbc_tfMaxIntegrationSteps.gridy = 8;
		tfMaxIntegrationSteps.setInputVerifier(new IntInputVerifier());
		tfMaxIntegrationSteps.setColumns(10);
		panel_32.add(tfMaxIntegrationSteps, gbc_tfMaxIntegrationSteps);

		cbExoSaturate.addChangeListener(new ChangeListener() {
			@Override
			public void stateChanged(ChangeEvent e) {
				JCheckBox cb = (JCheckBox) e.getSource();
				if (cb.isSelected()) {
					cbExoCoupling.setEnabled(true);
				} else {
					cbExoCoupling.setEnabled(false);
				}
			}
		});

		panel_10 = new JPanel();
		tabbedPane.addTab("Which to optimize?", null, panel_10, null);
		panel_10.setLayout(null);

		panel_11 = new JPanel();
		panel_11.setBounds(285, 325, 69, -219);
		panel_10.add(panel_11);

		panel_13 = new JPanel();
		panel_13.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_13.setBounds(12, 12, 244, 113);
		panel_10.add(panel_13);
		panel_13.setLayout(null);

		cbOptTemplate = new JCheckBox("Optimize Template");
		cbOptTemplate.setSelected(true);
		cbOptTemplate.setBounds(6, 7, 193, 23);
		panel_13.add(cbOptTemplate);

		lblNewLabel_2 = new JLabel("Default Value");
		lblNewLabel_2.setBounds(16, 37, 98, 14);
		panel_13.add(lblNewLabel_2);

		tfTemplateDefault = new JTextField();
		tfTemplateDefault.setText("25");
		tfTemplateDefault.setBounds(188, 34, 46, 20);
		panel_13.add(tfTemplateDefault);
		tfTemplateDefault.setColumns(10);

		lblMinValue = new JLabel("Min Value");
		lblMinValue.setBounds(16, 62, 98, 14);
		panel_13.add(lblMinValue);

		lblMaxValue = new JLabel("Max Value");
		lblMaxValue.setBounds(16, 87, 98, 14);
		panel_13.add(lblMaxValue);

		tfTemplateMin = new JTextField();
		tfTemplateMin.setText("-60");
		tfTemplateMin.setColumns(10);
		tfTemplateMin.setBounds(188, 59, 46, 20);
		panel_13.add(tfTemplateMin);

		tfTemplateMax = new JTextField();
		tfTemplateMax.setText("60");
		tfTemplateMax.setColumns(10);
		tfTemplateMax.setBounds(188, 84, 46, 20);
		panel_13.add(tfTemplateMax);

		panelOptSignalSequenceOld = new JPanel();
		panelOptSignalSequenceOld.setLayout(null);
		panelOptSignalSequenceOld.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelOptSignalSequenceOld.setBounds(266, 12, 244, 113);
		panel_10.add(panelOptSignalSequenceOld);

		cbOptSeqK = new JCheckBox("Optimize Signal Sequence K");
		cbOptSeqK.setSelected(true);
		cbOptSeqK.setBounds(6, 7, 193, 23);
		panelOptSignalSequenceOld.add(cbOptSeqK);

		label_3 = new JLabel("Default Value");
		label_3.setBounds(16, 37, 98, 14);
		panelOptSignalSequenceOld.add(label_3);

		tfSeqKDefault = new JTextField();
		tfSeqKDefault.setText("50");
		tfSeqKDefault.setColumns(10);
		tfSeqKDefault.setBounds(188, 34, 46, 20);
		panelOptSignalSequenceOld.add(tfSeqKDefault);

		label_4 = new JLabel("Min Value");
		label_4.setBounds(16, 62, 98, 14);
		panelOptSignalSequenceOld.add(label_4);

		lblMaxValue_1 = new JLabel("Max Value");
		lblMaxValue_1.setBounds(16, 87, 98, 14);
		panelOptSignalSequenceOld.add(lblMaxValue_1);

		tfSeqKMin = new JTextField();
		tfSeqKMin.setText("0.15");
		tfSeqKMin.setColumns(10);
		tfSeqKMin.setBounds(188, 59, 46, 20);
		panelOptSignalSequenceOld.add(tfSeqKMin);

		tfSeqKMax = new JTextField();
		tfSeqKMax.setText("100");
		tfSeqKMax.setColumns(10);
		tfSeqKMax.setBounds(188, 84, 46, 20);
		panelOptSignalSequenceOld.add(tfSeqKMax);

		panel_15 = new JPanel();
		panel_15.setLayout(null);
		panel_15.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_15.setBounds(524, 12, 244, 113);
		panel_10.add(panel_15);

		label_6 = new JLabel("Default Value");
		label_6.setBounds(16, 37, 98, 14);
		panel_15.add(label_6);

		tfInhKDefault = new JTextField();
		tfInhKDefault.setText("0");
		tfInhKDefault.setColumns(10);
		tfInhKDefault.setBounds(188, 34, 46, 20);
		panel_15.add(tfInhKDefault);

		label_7 = new JLabel("Min Value");
		label_7.setBounds(16, 62, 98, 14);
		panel_15.add(label_7);

		lblMaxValue_2 = new JLabel("Max Value");
		lblMaxValue_2.setBounds(16, 87, 98, 14);
		panel_15.add(lblMaxValue_2);

		tfInhKMin = new JTextField();
		tfInhKMin.setText("0");
		tfInhKMin.setColumns(10);
		tfInhKMin.setBounds(188, 59, 46, 20);
		panel_15.add(tfInhKMin);

		tfInhKMax = new JTextField();
		tfInhKMax.setText("0");
		tfInhKMax.setColumns(10);
		tfInhKMax.setBounds(188, 84, 46, 20);
		panel_15.add(tfInhKMax);

		lblOptimizeInhibitionK = new JLabel("Optimize Inhibition K");
		lblOptimizeInhibitionK.setBounds(10, 11, 125, 14);
		panel_15.add(lblOptimizeInhibitionK);

		cbOptInhK = new JComboBox(new String[] { "No", "Yes", "7-6 rule" });
		cbOptInhK.addItemListener(new ItemListener() {
			public void itemStateChanged(ItemEvent arg0) {
				if (cbOptInhK.getSelectedItem().equals("7-6 rule")
						|| cbOptInhK.getSelectedItem().equals("Preset")) {
					tfInhKDefault.setEnabled(false);
					tfInhKMin.setEnabled(false);
					tfInhKMax.setEnabled(false);
				} else {
					tfInhKDefault.setEnabled(true);
					tfInhKMin.setEnabled(true);
					tfInhKMax.setEnabled(true);
				}
			}
		});
		cbOptInhK.setSelectedIndex(2);
		cbOptInhK.setBounds(151, 8, 83, 20);
		panel_15.add(cbOptInhK);

		panel_16 = new JPanel();
		panel_16.setLayout(null);
		panel_16.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_16.setBounds(12, 136, 244, 113);
		panel_10.add(panel_16);

		cbOptSeqConc = new JCheckBox("Optimize Seq's Concentration");
		cbOptSeqConc.setBounds(6, 7, 193, 23);
		panel_16.add(cbOptSeqConc);

		label_9 = new JLabel("Default Value");
		label_9.setBounds(16, 37, 98, 14);
		panel_16.add(label_9);

		tfSeqConcDefault = new JTextField();
		tfSeqConcDefault.setText("10");
		tfSeqConcDefault.setColumns(10);
		tfSeqConcDefault.setBounds(188, 34, 46, 20);
		panel_16.add(tfSeqConcDefault);

		label_10 = new JLabel("Min Value");
		label_10.setBounds(16, 62, 98, 14);
		panel_16.add(label_10);

		lblMaxValue_3 = new JLabel("Max Value");
		lblMaxValue_3.setBounds(16, 87, 98, 14);
		panel_16.add(lblMaxValue_3);

		tfSeqConcMin = new JTextField();
		tfSeqConcMin.setText("1");
		tfSeqConcMin.setColumns(10);
		tfSeqConcMin.setBounds(188, 59, 46, 20);
		panel_16.add(tfSeqConcMin);

		tfSeqConcMax = new JTextField();
		tfSeqConcMax.setText("20");
		tfSeqConcMax.setColumns(10);
		tfSeqConcMax.setBounds(188, 84, 46, 20);
		panel_16.add(tfSeqConcMax);

		panel_17 = new JPanel();
		panel_17.setLayout(null);
		panel_17.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_17.setBounds(524, 136, 244, 113);
		panel_10.add(panel_17);

		cbOptExoSimpleKm = new JCheckBox("Optimize ExoSimpleKm");
		cbOptExoSimpleKm.setBounds(6, 7, 193, 23);
		panel_17.add(cbOptExoSimpleKm);

		label_12 = new JLabel("Default Value");
		label_12.setBounds(16, 37, 98, 14);
		panel_17.add(label_12);

		tfExoSimpleKmDefault = new JTextField();
		tfExoSimpleKmDefault.setText("300");
		tfExoSimpleKmDefault.setColumns(10);
		tfExoSimpleKmDefault.setBounds(188, 34, 46, 20);
		panel_17.add(tfExoSimpleKmDefault);

		label_13 = new JLabel("Min Value");
		label_13.setBounds(16, 62, 98, 14);
		panel_17.add(label_13);

		lblMaxValue_5 = new JLabel("Max Value");
		lblMaxValue_5.setBounds(16, 87, 98, 14);
		panel_17.add(lblMaxValue_5);

		tfExoSimpleKmMin = new JTextField();
		tfExoSimpleKmMin.setText("0");
		tfExoSimpleKmMin.setColumns(10);
		tfExoSimpleKmMin.setBounds(188, 59, 46, 20);
		panel_17.add(tfExoSimpleKmMin);

		tfExoSimpleKmMax = new JTextField();
		tfExoSimpleKmMax.setText("0");
		tfExoSimpleKmMax.setColumns(10);
		tfExoSimpleKmMax.setBounds(188, 84, 46, 20);
		panel_17.add(tfExoSimpleKmMax);

		panel_18 = new JPanel();
		panel_18.setLayout(null);
		panel_18.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_18.setBounds(266, 136, 244, 113);
		panel_10.add(panel_18);

		cbOptExoAct = new JCheckBox("Optimize Exo Activity");
		cbOptExoAct.setBounds(6, 7, 193, 23);
		panel_18.add(cbOptExoAct);

		label_15 = new JLabel("Default Value");
		label_15.setBounds(16, 37, 98, 14);
		panel_18.add(label_15);

		tfExoActDefault = new JTextField();
		tfExoActDefault.setText("1");
		tfExoActDefault.setColumns(10);
		tfExoActDefault.setBounds(188, 34, 46, 20);
		panel_18.add(tfExoActDefault);

		label_16 = new JLabel("Min Value");
		label_16.setBounds(16, 62, 98, 14);
		panel_18.add(label_16);

		lblMaxValue_4 = new JLabel("Max Value");
		lblMaxValue_4.setBounds(16, 87, 98, 14);
		panel_18.add(lblMaxValue_4);

		tfExoActMin = new JTextField();
		tfExoActMin.setText("0");
		tfExoActMin.setColumns(10);
		tfExoActMin.setBounds(188, 59, 46, 20);
		panel_18.add(tfExoActMin);

		tfExoActMax = new JTextField();
		tfExoActMax.setText("0");
		tfExoActMax.setColumns(10);
		tfExoActMax.setBounds(188, 84, 46, 20);
		panel_18.add(tfExoActMax);

		panel_19 = new JPanel();
		panel_19.setLayout(null);
		panel_19.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_19.setBounds(12, 260, 244, 113);
		panel_10.add(panel_19);

		cbOptInhibKm = new JCheckBox("Optimize InhibKm");
		cbOptInhibKm.setBounds(6, 7, 193, 23);
		panel_19.add(cbOptInhibKm);

		label_18 = new JLabel("Default Value");
		label_18.setBounds(16, 37, 98, 14);
		panel_19.add(label_18);

		tfInhibKmDefault = new JTextField();
		tfInhibKmDefault.setText("135");
		tfInhibKmDefault.setColumns(10);
		tfInhibKmDefault.setBounds(188, 34, 46, 20);
		panel_19.add(tfInhibKmDefault);

		label_19 = new JLabel("Min Value");
		label_19.setBounds(16, 62, 98, 14);
		panel_19.add(label_19);

		lblMaxValue_6 = new JLabel("Max Value");
		lblMaxValue_6.setBounds(16, 87, 98, 14);
		panel_19.add(lblMaxValue_6);

		tfInhibKmMin = new JTextField();
		tfInhibKmMin.setText("0");
		tfInhibKmMin.setColumns(10);
		tfInhibKmMin.setBounds(188, 59, 46, 20);
		panel_19.add(tfInhibKmMin);

		tfInhibKmMax = new JTextField();
		tfInhibKmMax.setText("0");
		tfInhibKmMax.setColumns(10);
		tfInhibKmMax.setBounds(188, 84, 46, 20);
		panel_19.add(tfInhibKmMax);

		panel_20 = new JPanel();
		panel_20.setLayout(null);
		panel_20.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_20.setBounds(266, 260, 244, 113);
		panel_10.add(panel_20);

		cbOptPolAct = new JCheckBox("Optimize Pol Activity");
		cbOptPolAct.setBounds(6, 7, 193, 23);
		panel_20.add(cbOptPolAct);

		label_21 = new JLabel("Default Value");
		label_21.setBounds(16, 37, 98, 14);
		panel_20.add(label_21);

		tfPolActDefault = new JTextField();
		tfPolActDefault.setText("17");
		tfPolActDefault.setColumns(10);
		tfPolActDefault.setBounds(188, 34, 46, 20);
		panel_20.add(tfPolActDefault);

		label_22 = new JLabel("Min Value");
		label_22.setBounds(16, 62, 98, 14);
		panel_20.add(label_22);

		lblMaxValue_7 = new JLabel("Max Value");
		lblMaxValue_7.setBounds(16, 87, 98, 14);
		panel_20.add(lblMaxValue_7);

		tfPolActMin = new JTextField();
		tfPolActMin.setText("8.5");
		tfPolActMin.setColumns(10);
		tfPolActMin.setBounds(188, 59, 46, 20);
		panel_20.add(tfPolActMin);

		tfPolActMax = new JTextField();
		tfPolActMax.setText("25.5");
		tfPolActMax.setColumns(10);
		tfPolActMax.setBounds(188, 84, 46, 20);
		panel_20.add(tfPolActMax);

		panel_21 = new JPanel();
		panel_21.setLayout(null);
		panel_21.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_21.setBounds(524, 260, 244, 113);
		panel_10.add(panel_21);

		cbOptPolKm = new JCheckBox("Optimize Pol Km");
		cbOptPolKm.setBounds(6, 7, 193, 23);
		panel_21.add(cbOptPolKm);

		label_24 = new JLabel("Default Value");
		label_24.setBounds(16, 37, 98, 14);
		panel_21.add(label_24);

		tfPolKmDefault = new JTextField();
		tfPolKmDefault.setText("0");
		tfPolKmDefault.setColumns(10);
		tfPolKmDefault.setBounds(188, 34, 46, 20);
		panel_21.add(tfPolKmDefault);

		label_25 = new JLabel("Min Value");
		label_25.setBounds(16, 62, 98, 14);
		panel_21.add(label_25);

		lblMaxValue_8 = new JLabel("Max Value");
		lblMaxValue_8.setBounds(16, 87, 98, 14);
		panel_21.add(lblMaxValue_8);

		tfPolKmMin = new JTextField();
		tfPolKmMin.setText("0");
		tfPolKmMin.setColumns(10);
		tfPolKmMin.setBounds(188, 59, 46, 20);
		panel_21.add(tfPolKmMin);

		tfPolKmMax = new JTextField();
		tfPolKmMax.setText("0");
		tfPolKmMax.setColumns(10);
		tfPolKmMax.setBounds(188, 84, 46, 20);
		panel_21.add(tfPolKmMax);

		panel_22 = new JPanel();
		panel_22.setLayout(null);
		panel_22.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_22.setBounds(12, 384, 244, 113);
		panel_10.add(panel_22);

		cbOptPol2StrandKm = new JCheckBox("Optimize Pol Double Strand Km");
		cbOptPol2StrandKm.setBounds(6, 7, 232, 23);
		panel_22.add(cbOptPol2StrandKm);

		label_27 = new JLabel("Default Value");
		label_27.setBounds(16, 37, 98, 14);
		panel_22.add(label_27);

		tfPol2StrandKmDefault = new JTextField();
		tfPol2StrandKmDefault.setText("0");
		tfPol2StrandKmDefault.setColumns(10);
		tfPol2StrandKmDefault.setBounds(192, 34, 46, 20);
		panel_22.add(tfPol2StrandKmDefault);

		label_28 = new JLabel("Min Value");
		label_28.setBounds(16, 62, 98, 14);
		panel_22.add(label_28);

		lblMaxValue_9 = new JLabel("Max Value");
		lblMaxValue_9.setBounds(16, 87, 98, 14);
		panel_22.add(lblMaxValue_9);

		tfPol2StrandKmMin = new JTextField();
		tfPol2StrandKmMin.setText("0");
		tfPol2StrandKmMin.setColumns(10);
		tfPol2StrandKmMin.setBounds(192, 59, 46, 20);
		panel_22.add(tfPol2StrandKmMin);

		tfPol2StrandKmMax = new JTextField();
		tfPol2StrandKmMax.setText("0");
		tfPol2StrandKmMax.setColumns(10);
		tfPol2StrandKmMax.setBounds(192, 84, 46, 20);
		panel_22.add(tfPol2StrandKmMax);

		panel_23 = new JPanel();
		panel_23.setLayout(null);
		panel_23.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_23.setBounds(266, 384, 244, 113);
		panel_10.add(panel_23);

		cbOptNickAct = new JCheckBox("Optimize Nick Activity");
		cbOptNickAct.setBounds(6, 7, 193, 23);
		panel_23.add(cbOptNickAct);

		label_30 = new JLabel("Default Value");
		label_30.setBounds(16, 37, 98, 14);
		panel_23.add(label_30);

		tfNickActDefault = new JTextField();
		tfNickActDefault.setText("3");
		tfNickActDefault.setColumns(10);
		tfNickActDefault.setBounds(188, 34, 46, 20);
		panel_23.add(tfNickActDefault);

		label_31 = new JLabel("Min Value");
		label_31.setBounds(16, 62, 98, 14);
		panel_23.add(label_31);

		lblMaxValue_10 = new JLabel("Max Value");
		lblMaxValue_10.setBounds(16, 87, 98, 14);
		panel_23.add(lblMaxValue_10);

		tfNickActMin = new JTextField();
		tfNickActMin.setText("1.5");
		tfNickActMin.setColumns(10);
		tfNickActMin.setBounds(188, 59, 46, 20);
		panel_23.add(tfNickActMin);

		tfNickActMax = new JTextField();
		tfNickActMax.setText("4.5");
		tfNickActMax.setColumns(10);
		tfNickActMax.setBounds(188, 84, 46, 20);
		panel_23.add(tfNickActMax);

		panel_24 = new JPanel();
		panel_24.setLayout(null);
		panel_24.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_24.setBounds(524, 384, 244, 113);
		panel_10.add(panel_24);

		cbOptNickKm = new JCheckBox("Optimize NickKm");
		cbOptNickKm.setBounds(6, 7, 193, 23);
		panel_24.add(cbOptNickKm);

		label_33 = new JLabel("Default Value");
		label_33.setBounds(16, 37, 98, 14);
		panel_24.add(label_33);

		tfNickKmDefault = new JTextField();
		tfNickKmDefault.setText("0");
		tfNickKmDefault.setColumns(10);
		tfNickKmDefault.setBounds(188, 34, 46, 20);
		panel_24.add(tfNickKmDefault);

		label_34 = new JLabel("Min Value");
		label_34.setBounds(16, 62, 98, 14);
		panel_24.add(label_34);

		lblMaxValue_11 = new JLabel("Max Value");
		lblMaxValue_11.setBounds(16, 87, 98, 14);
		panel_24.add(lblMaxValue_11);

		tfNickKmMin = new JTextField();
		tfNickKmMin.setText("0");
		tfNickKmMin.setColumns(10);
		tfNickKmMin.setBounds(188, 59, 46, 20);
		panel_24.add(tfNickKmMin);

		tfNickKmMax = new JTextField();
		tfNickKmMax.setText("0");
		tfNickKmMax.setColumns(10);
		tfNickKmMax.setBounds(188, 84, 46, 20);
		panel_24.add(tfNickKmMax);

		panelOptSignalSequenceNew = new JPanel();
		panelOptSignalSequenceNew.setVisible(false);
		panelOptSignalSequenceNew.setLayout(null);
		panelOptSignalSequenceNew.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelOptSignalSequenceNew.setBounds(780, 12, 244, 113);
		panel_10.add(panelOptSignalSequenceNew);

		JScrollPane scrollPane_1 = new JScrollPane();
		scrollPane_1.setBounds(6, 38, 226, 63);
		panelOptSignalSequenceNew.add(scrollPane_1);

		JTextArea textArea = new JTextArea();
		textArea.setEditable(false);
		textArea.setLineWrap(true);
		StringBuilder builder = new StringBuilder();
		for (int i = 0; i < Static.seqStr.length; i++) {
			builder.append(i + ":" + Static.seqStr[i] + ":" + Static.seqK[i]
					+ "\r\n");
		}
		textArea.setText(builder.toString());
		scrollPane_1.setViewportView(textArea);

		JLabel lblNewLabel_3 = new JLabel("List of sequences and Ks");
		lblNewLabel_3.setBounds(6, 10, 226, 16);
		panelOptSignalSequenceNew.add(lblNewLabel_3);

		panelFitness = new JPanel();
		tabbedPane.addTab("Fitness Function", null, panelFitness, null);
		panelFitness.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelFitness.setLayout(null);

		lblFitnessFuncion = new JLabel("Fitness Funcion");
		lblFitnessFuncion.setBounds(10, 11, 114, 14);
		panelFitness.add(lblFitnessFuncion);

		panelFitnessFunction = new JPanel();
		panelFitnessFunction.setBounds(10, 67, 438, 419);
		panelFitness.add(panelFitnessFunction);
		panelFitnessFunction.setLayout(new CardLayout(0, 0));
		String[] comboBoxStrings = new String[common.Static.runs.length];

		for (int i = 0; i < comboBoxStrings.length; i++) {
			comboBoxStrings[i] = common.Static.runs[i].getName();
			JPanel panel1 = new JPanel();
			panel1.setLayout(null);
			int count = 0;
			HashMap<String, String> parameters = common.Static.runs[i]
					.getDefaultParameters();
			for (String str : parameters.keySet()) {
				JLabel tmpLabel = new JLabel(str);
				tmpLabel.setBounds(10, count * 25 + 11, 150, 14);
				panel1.add(tmpLabel);
				JTextField textField = new JTextField();
				textField.setBounds(160, count * 25 + 8, 146, 20);
				panel1.add(textField);
				textField.setColumns(10);
				textField.setText(parameters.get(str));
				textFields.put(comboBoxStrings[i] + "_" + str, textField);
				count++;
			}
			panelFitnessFunction.add(panel1, comboBoxStrings[i]);
		}
		cbFitnessFunction = new JComboBox(comboBoxStrings);
		cbFitnessFunction.addItemListener(new ItemListener() {
			public void itemStateChanged(ItemEvent evt) {
				CardLayout cl = (CardLayout) (panelFitnessFunction.getLayout());
				cl.show(panelFitnessFunction, (String) evt.getItem());
			}
		});
		cbFitnessFunction.setBounds(10, 36, 144, 20);
		panelFitness.add(cbFitnessFunction);

		JLabel lblStartingTopology = new JLabel("Starting topology");
		lblStartingTopology.setBounds(458, 11, 118, 14);
		panelFitness.add(lblStartingTopology);

		panelPrototypes = new JPanel();
		panelPrototypes.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelPrototypes.setBounds(458, 67, 120, 120);
		panelFitness.add(panelPrototypes);
		panelPrototypes.setLayout(new CardLayout());
		for (String str : common.Static.prototypes.keySet()) {
			JPanel card = new JPanel();
			card.setBounds(138, 367, 120, 120);
			card.add(new Individual(new HashMap<String, Integer>(),
					new HashMap<String, String>(), 0, 0, null,
					common.Static.prototypes.get(str)).getOligoModel()
					.getVisualization(120, 120), BorderLayout.CENTER);
			panelPrototypes.add(card, str);
			if (str.equals("Browse")) {
				browsedStructure = card;
			}
		}
		browsedStructure = new JPanel();
		browsedStructure.setBounds(138, 367, 120, 120);
		panelPrototypes.add(browsedStructure, "Browse");

		cbPrototypes = new JComboBox(common.Static.getListPrototypes());
		cbPrototypes.addItemListener(new ItemListener() {
			public void itemStateChanged(ItemEvent evt) {
				String selection = (String) evt.getItem();
				if (selection.equals("Browse")
						&& evt.getStateChange() == ItemEvent.SELECTED) {
					JFileChooser fc = new JFileChooser();
					int returnVal;
					do {
						returnVal = fc.showOpenDialog(null);
					} while (returnVal != JFileChooser.APPROVE_OPTION
							&& returnVal != JFileChooser.CANCEL_OPTION);
					if (returnVal == JFileChooser.APPROVE_OPTION) {
						File file = fc.getSelectedFile();

						try {
							String content = new Scanner(file).useDelimiter(
									"\\Z").next();
							common.Static.prototypes.put("Browse", content);
							browsedStructure.removeAll();
							browsedStructure.add(
									new Individual(
											new HashMap<String, Integer>(),
											new HashMap<String, String>(), 0,
											0, null, content).getOligoModel()
											.getVisualization(120, 120),
									BorderLayout.CENTER);
							txtIndividual.setText(content);
						} catch (Exception e) {
							cbPrototypes.setSelectedIndex(0);
							String initIndivName = (String) cbPrototypes
									.getSelectedItem();
							String initialIndividual = common.Static.prototypes
									.get(initIndivName);
							txtIndividual.setText(initialIndividual);
							return;
						}
					} else {
						cbPrototypes.setSelectedIndex(0);
						String initIndivName = (String) cbPrototypes
								.getSelectedItem();
						String initialIndividual = common.Static.prototypes
								.get(initIndivName);
						txtIndividual.setText(initialIndividual);
						return;
					}
				}
				CardLayout cl = (CardLayout) (panelPrototypes.getLayout());
				cl.show(panelPrototypes, selection);
				String initIndivName = (String) cbPrototypes.getSelectedItem();
				String initialIndividual = common.Static.prototypes
						.get(initIndivName);
				txtIndividual.setText(initialIndividual);

			}
		});
		cbPrototypes.setBounds(458, 36, 118, 20);
		panelFitness.add(cbPrototypes);

		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(586, 11, 343, 176);
		panelFitness.add(scrollPane);

		txtIndividual = new JTextArea();
		txtIndividual.setLineWrap(true);
		scrollPane.setViewportView(txtIndividual);

		JButton btnCheckFitness = new JButton("Check Fitness");
		btnCheckFitness.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				panelCheckFitness.removeAll();
				GraphDisplayer bestIndividuals = new GraphDisplayer(
						panelCheckFitness.getSize().width, panelCheckFitness
								.getSize().height);
				panelCheckFitness.add(bestIndividuals.getContentPanel(),
						BorderLayout.CENTER);
				updateConstantsFromFields();
				updateRunParameterFromFields();
				updateRunConfig();
				final String initialIndividual = txtIndividual.getText();
				run.initialize(runConfig, initialIndividual,
						panelFitnessOverGeneration,
						panelSpeciesVisualOverGeneration,
						panelBestIndivOverGeneration, progressBar, null);
				Individual indiv = run.getGA().getInitialIndividual();
				Fitness evaluator = run.getFitnessFunction();
				indiv.fitnessResult = evaluator.evaluateFitness(indiv
						.getOligoModel());
				bestIndividuals.addIndividual(indiv);
				panelCheckFitness.revalidate();
			}
		});
		btnCheckFitness.setBounds(941, 161, 170, 26);
		panelFitness.add(btnCheckFitness);

		panelCheckFitness = new JPanel();
		panelCheckFitness.setBounds(460, 199, 949, 533);
		panelFitness.add(panelCheckFitness);
		panelCheckFitness.setLayout(new BorderLayout(0, 0));

		panelResult = new JPanel();
		tabbedPane.addTab("Result", null, panelResult, null);
		panelResult.setLayout(null);

		panelFitnessOverGeneration = new JPanel();
		panelFitnessOverGeneration
				.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelFitnessOverGeneration.setBounds(10, 11, 500, 340);
		panelResult.add(panelFitnessOverGeneration);
		panelFitnessOverGeneration.setLayout(new BorderLayout(0, 0));

		panelSpeciesVisualOverGeneration = new JPanel();
		panelSpeciesVisualOverGeneration.setBorder(new LineBorder(new Color(0,
				0, 0)));
		panelSpeciesVisualOverGeneration.setBounds(10, 362, 500, 340);
		panelResult.add(panelSpeciesVisualOverGeneration);
		panelSpeciesVisualOverGeneration.setLayout(new BorderLayout(0, 0));

		panelBestIndivOverGeneration = new JPanel();
		panelBestIndivOverGeneration.setBorder(new LineBorder(
				new Color(0, 0, 0)));
		panelBestIndivOverGeneration.setBounds(520, 11, 949, 691);
		panelResult.add(panelBestIndivOverGeneration);
		panelBestIndivOverGeneration.setLayout(new BorderLayout(0, 0));

		progressBar = new JProgressBar();
		progressBar.setStringPainted(true);
		progressBar.setBounds(10, 713, 1459, 17);
		panelResult.add(progressBar);
	}

	public void updateFieldsFromConstants() {
		chckbxNewModel.setSelected(Constants.optimizeSeqString);
		tfNRuns.setText(String.valueOf(Constants.nRuns));
		txtDefault.setText(Constants.prefix);
		tfPopSize.setText(String.valueOf(Constants.popSize));
		tfMaxGen.setText(String.valueOf(Constants.generations));
		tfTourSize.setText(String.valueOf(Constants.tournamentSize));
		tfMutaOnly.setText(String.valueOf(Constants.probMutationOnly));
		tmp = 100 * Constants.probMutationOnly;
		slMutaOnly.setValue(tmp.intValue());
		tfInterspCross
				.setText(String.valueOf(Constants.interspeciesMatingRate));
		tmp = 100 * Constants.interspeciesMatingRate;
		slInterspCross.setValue(tmp.intValue());
		tfMutaAftCross
				.setText(String.valueOf(Constants.probIndividualMutation));
		tmp = 100 * Constants.probIndividualMutation;
		slMutaAftCross.setValue(tmp.intValue());
		tfParamOnly.setText(String.valueOf(Constants.probParamMutation));
		tmp = 100 * Constants.probParamMutation;
		slParamOnly.setValue(tmp.intValue());
		tfSingleGenMuta.setText(String.valueOf(Constants.probGeneMutation));
		tmp = 100 * Constants.probGeneMutation;
		slSingleGenMuta.setValue(tmp.intValue());
		tfRandOrGauss.setText(String.valueOf(Constants.probRandomParamMutate));
		tmp = 100 * Constants.probRandomParamMutate;
		slRandOrGauss.setValue(tmp.intValue());
		tfTempDisabled.setText(String
				.valueOf(Constants.probConnectionDisabling));
		tmp = 100 * Constants.probConnectionDisabling;
		slTempDisabled.setValue(tmp.intValue());
		tfGauss1.setText(String.valueOf(Constants.paramMutateGaussianFactor));
		tfGauss2.setText(String.valueOf(Constants.paramMutateGaussianFactor2));
		tfAddNode.setText(String.valueOf(Constants.probAddNodeMutation));
		tmp = 100 * Constants.probAddNodeMutation;
		slAddNode.setValue(tmp.intValue());
		tfAddActivation.setText(String.valueOf(Constants.probAddActivation));
		tmp = 100 * Constants.probAddActivation;
		slAddActivation.setValue(tmp.intValue());
		tfAddDoubleInhibition.setText(String
				.valueOf(Constants.probAddDoubleInhibition));
		tmp = 100 * Constants.probAddDoubleInhibition;
		slAddDoubleInhibition.setValue(tmp.intValue());
		tfC1.setText(String.valueOf(Constants.c1));
		tfC2.setText(String.valueOf(Constants.c2));
		tfC3.setText(String.valueOf(Constants.c3));
		tfSpeThres.setText(String.valueOf(Constants.speciationThreshold));
		tfTargetNSpecies.setText(String.valueOf(Constants.targetNSpecies));
		tfMinSpeThres.setText(String.valueOf(Constants.speciationThresholdMin));
		tfSpeThresMod.setText(String.valueOf(Constants.speciationThresholdMod));
		cbRemoveNonImprovingSpecies
				.setSelected(Constants.removeNonImprovingSpecies);
		tfNNonImproveGenerations.setText(String
				.valueOf(Constants.nNonInprovingGenerations));
		cbAutoSpeThres.setSelected(Constants.autoSpeciationThreshold);
		cbPrototypes.setSelectedIndex(1);
		cbPrototypes.setSelectedIndex(0);
		cbExoSaturate.setSelected(model.Constants.saturableExonuclease);
		cbExoCoupling.setSelected(model.Constants.coupledExonuclease);
		cbPolySaturate.setSelected(model.Constants.saturablePoly);
		cbPolyCoupling.setSelected(model.Constants.coupledPoly);
		cbNickSaturate.setSelected(model.Constants.saturableNick);
		cbNickCoupling.setSelected(model.Constants.coupledNick);
		cbExoSaturateByFreeTemplates
				.setSelected(model.Constants.exoSaturationByFreeTemplates);
		cbExoSaturationByTemplatesAll
				.setSelected(model.Constants.exoSaturationByTemplatesAll);
		tfKduplex.setText(String.valueOf(model.Constants.Kduplex));
		tfNickAct.setText(String.valueOf(model.Constants.n));
		tfPolyAct.setText(String.valueOf(model.Constants.p));
		tfLembda.setText(String.valueOf(model.Constants.lembda));
		tfExoAct.setText(String.valueOf(model.Constants.exo));
		tfExoInhib.setText(String.valueOf(model.Constants.exoInhib));
		tfDispl.setText(String.valueOf(model.Constants.displ));
		tfExoVm.setText(String.valueOf(model.Constants.exoVm));
		tfExoKmSimple.setText(String.valueOf(model.Constants.exoKmSimple));
		tfExoKmInhib.setText(String.valueOf(model.Constants.exoKmInhib));
		tfExoKmTemplate.setText(String.valueOf(model.Constants.exoKmTemplate));
		tfPolKm.setText(String.valueOf(model.Constants.polKm));
		tfNickVm.setText(String.valueOf(model.Constants.nickVm));
		tfLeakRatio.setText(String.valueOf(model.Constants.leakRatio));
		tfToeholdLeft.setText(String.valueOf(model.Constants.ratioToeholdLeft));
		tfToeholdRight.setText(String
				.valueOf(model.Constants.ratioToeholdRight));
		tfPolVm.setText(String.valueOf(model.Constants.polVm));
		tfPolKmBoth.setText(String.valueOf(model.Constants.polKmBoth));
		tfNickKm.setText(String.valueOf(model.Constants.nickKm));
		tfRatioInhib.setText(String.valueOf(model.Constants.ratioInhibition));
		tfMaxTimeComplex.setText(String.valueOf(model.Constants.maxTime));
		tfNPoints.setText(String.valueOf(model.Constants.numberOfPoints));
		tfMaxTimeSimple.setText(String.valueOf(model.Constants.maxTimeSimple));
		tfIntegrationAbsError.setText(String
				.valueOf(model.Constants.integrationAbsoluteError));
		tfIntegrationRelError.setText(String
				.valueOf(model.Constants.integrationRelativeError));
		tfThresholdStable.setText(String
				.valueOf(optimizers.commons.GAConstants.changeThresholdStable));
		tfMinTimeStable.setText(String
				.valueOf(optimizers.commons.GAConstants.minTimeStable));
		tfMaxIntegrationSteps.setText(String
				.valueOf(optimizers.commons.GAConstants.maxIntegrationSteps));
	}

	private void updateSlider(JSlider slider, JTextField textField) {
		Double tmp = 100 * Double.valueOf(textField.getText());
		slider.setValue(tmp.intValue());
	}

	private void updateConstantsFromFields() {
		Constants.optimizeSeqString = chckbxNewModel.isSelected();
		Constants.nRuns = Integer.parseInt(tfNRuns.getText());
		Constants.prefix = txtDefault.getText();
		Constants.popSize = Integer.parseInt(tfPopSize.getText());
		Constants.generations = Integer.parseInt(tfMaxGen.getText());
		Constants.tournamentSize = Integer.parseInt(tfTourSize.getText());
		Constants.probMutationOnly = Double.parseDouble(tfMutaOnly.getText());
		Constants.interspeciesMatingRate = Double.parseDouble(tfInterspCross
				.getText());
		Constants.probIndividualMutation = Double.parseDouble(tfMutaAftCross
				.getText());
		Constants.probParamMutation = Double.parseDouble(tfParamOnly.getText());
		Constants.probGeneMutation = Double.parseDouble(tfSingleGenMuta
				.getText());
		Constants.probRandomParamMutate = Double.parseDouble(tfRandOrGauss
				.getText());
		Constants.probConnectionDisabling = Double.parseDouble(tfTempDisabled
				.getText());
		Constants.paramMutateGaussianFactor = Double.parseDouble(tfGauss1
				.getText());
		Constants.paramMutateGaussianFactor2 = Double.parseDouble(tfGauss2
				.getText());
		Constants.probAddNodeMutation = Double.parseDouble(tfAddNode.getText());
		Constants.probAddActivation = Double.parseDouble(tfAddActivation
				.getText());
		Constants.probAddDoubleInhibition = Double
				.parseDouble(tfAddDoubleInhibition.getText());
		Constants.c1 = Double.parseDouble(tfC1.getText());
		Constants.c2 = Double.parseDouble(tfC2.getText());
		Constants.c3 = Double.parseDouble(tfC3.getText());
		Constants.speciationThreshold = Double
				.parseDouble(tfSpeThres.getText());
		Constants.targetNSpecies = Integer.parseInt(tfTargetNSpecies.getText());
		Constants.speciationThresholdMin = Double.parseDouble(tfMinSpeThres
				.getText());
		Constants.speciationThresholdMod = Double.parseDouble(tfSpeThresMod
				.getText());
		Constants.removeNonImprovingSpecies = cbRemoveNonImprovingSpecies
				.isSelected();
		Constants.nNonInprovingGenerations = Integer
				.parseInt(tfNNonImproveGenerations.getText());
		Constants.autoSpeciationThreshold = cbAutoSpeThres.isSelected();

		model.Constants.saturableExonuclease = cbExoSaturate.isSelected();
		model.Constants.coupledExonuclease = cbExoCoupling.isSelected();
		model.Constants.saturablePoly = cbPolySaturate.isSelected();
		model.Constants.coupledPoly = cbPolyCoupling.isSelected();
		model.Constants.saturableNick = cbNickSaturate.isSelected();
		model.Constants.coupledNick = cbNickCoupling.isSelected();
		model.Constants.exoSaturationByFreeTemplates = cbExoSaturateByFreeTemplates
				.isSelected();
		model.Constants.exoSaturationByTemplatesAll = cbExoSaturationByTemplatesAll
				.isSelected();

		model.Constants.Kduplex = Double.parseDouble(tfKduplex.getText());
		model.Constants.n = Double.parseDouble(tfNickAct.getText());
		model.Constants.p = Double.parseDouble(tfPolyAct.getText());
		model.Constants.lembda = Double.parseDouble(tfLembda.getText());
		model.Constants.exo = Double.parseDouble(tfExoAct.getText());
		model.Constants.exoInhib = Double.parseDouble(tfExoInhib.getText());
		model.Constants.displ = Double.parseDouble(tfDispl.getText());
		model.Constants.exoVm = Double.parseDouble(tfExoVm.getText());
		model.Constants.exoKmSimple = Double.parseDouble(tfExoKmSimple
				.getText());
		model.Constants.exoKmInhib = Double.parseDouble(tfExoKmInhib.getText());
		model.Constants.exoKmTemplate = Double.parseDouble(tfExoKmTemplate
				.getText());
		model.Constants.polKm = Double.parseDouble(tfPolKm.getText());
		model.Constants.nickVm = Double.parseDouble(tfNickVm.getText());
		model.Constants.leakRatio = Double.parseDouble(tfLeakRatio.getText());
		model.Constants.ratioToeholdLeft = Double.parseDouble(tfToeholdLeft
				.getText());
		model.Constants.ratioToeholdRight = Double.parseDouble(tfToeholdRight
				.getText());
		model.Constants.polVm = Double.parseDouble(tfPolVm.getText());
		model.Constants.polKmBoth = Double.parseDouble(tfPolKmBoth.getText());
		model.Constants.nickKm = Double.parseDouble(tfNickKm.getText());
		model.Constants.ratioInhibition = Double.parseDouble(tfRatioInhib
				.getText());
		model.Constants.maxTime = Double
				.parseDouble(tfMaxTimeComplex.getText());
		model.Constants.numberOfPoints = Integer.parseInt(tfNPoints.getText());
		model.Constants.maxTimeSimple = Integer.parseInt(tfMaxTimeSimple
				.getText());
		model.Constants.integrationAbsoluteError = Double
				.parseDouble(tfIntegrationAbsError.getText());
		model.Constants.integrationRelativeError = Double
				.parseDouble(tfIntegrationRelError.getText());
		optimizers.commons.GAConstants.changeThresholdStable = Double
				.parseDouble(tfThresholdStable.getText());
		optimizers.commons.GAConstants.minTimeStable = Integer
				.parseInt(tfMinTimeStable.getText());
		optimizers.commons.GAConstants.maxIntegrationSteps = Integer
				.parseInt(tfMaxIntegrationSteps.getText());
	}

	private HashMap<String, String> updateRunParameterFromFields() {
		run = common.Static.runs[cbFitnessFunction.getSelectedIndex()];
		HashMap<String, String> parameters = new HashMap<String, String>();
		for (String str : run.getDefaultParameters().keySet()) {
			JTextField tf = textFields.get(run.getName() + "_" + str);
			parameters.put(str, tf.getText());
		}
		run.setParameters(parameters);
		return parameters;
	}

	private void updateRunConfig() {
		runConfig.evaluator = run.getFitnessFunction();
		runConfig.exoActivity = new Parameter(cbOptExoAct.isSelected() ? 1 : 0,
				Double.parseDouble(tfExoActDefault.getText()),
				Double.parseDouble(tfExoActMin.getText()),
				Double.parseDouble(tfExoActMax.getText()), new double[] {});
		runConfig.exoInhibKm = new Parameter(cbOptInhibKm.isSelected() ? 1 : 0,
				Double.parseDouble(tfInhibKmDefault.getText()),
				Double.parseDouble(tfInhibKmMin.getText()),
				Double.parseDouble(tfInhibKmMax.getText()), new double[] {});
		runConfig.exoSimpleKm = new Parameter(cbOptExoSimpleKm.isSelected() ? 1
				: 0, Double.parseDouble(tfExoSimpleKmDefault.getText()),
				Double.parseDouble(tfExoSimpleKmMin.getText()),
				Double.parseDouble(tfExoSimpleKmMax.getText()), new double[] {});
		runConfig.inhK = new Parameter(cbOptInhK.getSelectedIndex(),
				Double.parseDouble(tfInhKDefault.getText()),
				Double.parseDouble(tfInhKMin.getText()),
				Double.parseDouble(tfInhKMax.getText()), new double[] {});
		runConfig.nickActivity = new Parameter(cbOptNickAct.isSelected() ? 1
				: 0, Double.parseDouble(tfNickActDefault.getText()),
				Double.parseDouble(tfNickActMin.getText()),
				Double.parseDouble(tfNickActMax.getText()), new double[] {});
		runConfig.nickKm = new Parameter(cbOptNickKm.isSelected() ? 1 : 0,
				Double.parseDouble(tfNickKmDefault.getText()),
				Double.parseDouble(tfNickKmMin.getText()),
				Double.parseDouble(tfNickKmMax.getText()), new double[] {});
		runConfig.polActivity = new Parameter(cbOptPolAct.isSelected() ? 1 : 0,
				Double.parseDouble(tfPolActDefault.getText()),
				Double.parseDouble(tfPolActMin.getText()),
				Double.parseDouble(tfPolActMax.getText()), new double[] {});

		runConfig.polDoubleStrandKm = new Parameter(
				cbOptPol2StrandKm.isSelected() ? 1 : 0,
				Double.parseDouble(tfPol2StrandKmDefault.getText()),
				Double.parseDouble(tfPol2StrandKmMin.getText()),
				Double.parseDouble(tfPol2StrandKmMax.getText()),
				new double[] {});
		runConfig.polKm = new Parameter(cbOptPolKm.isSelected() ? 1 : 0,
				Double.parseDouble(tfPolKmDefault.getText()),
				Double.parseDouble(tfPolKmMin.getText()),
				Double.parseDouble(tfPolKmMax.getText()), new double[] {});
		runConfig.seqC = new Parameter(cbOptSeqConc.isSelected() ? 1 : 0,
				Double.parseDouble(tfSeqConcDefault.getText()),
				Double.parseDouble(tfSeqConcMin.getText()),
				Double.parseDouble(tfSeqConcMax.getText()), new double[] {});
		runConfig.seqK = new Parameter(cbOptSeqK.isSelected() ? 1 : 0,
				Double.parseDouble(tfSeqKDefault.getText()),
				Double.parseDouble(tfSeqKMin.getText()),
				Double.parseDouble(tfSeqKMax.getText()), new double[] {});
		runConfig.template = new Parameter(cbOptTemplate.isSelected() ? 1 : 0,
				Double.parseDouble(tfTemplateDefault.getText()),
				Double.parseDouble(tfTemplateMin.getText()),
				Double.parseDouble(tfTemplateMax.getText()), new double[] {});
	}

	private void saveFieldsToFile(File file) {
		try {
			FileOutputStream fos = new FileOutputStream(file);
			Properties properties = new Properties();
			properties.setProperty(NUMBER_OF_RUNS, tfNRuns.getText());
			properties.setProperty(POP_SIZE, tfPopSize.getText());
			properties.setProperty(MAX_GENERATION, tfMaxGen.getText());
			properties.setProperty(TOURNAMENT_SIZE, tfTourSize.getText());
			properties.setProperty(PROB_MUTATION_ONLY, tfMutaOnly.getText());
			properties.setProperty(PROB_INTERSPECIES_MATING,
					tfInterspCross.getText());
			properties.setProperty(PROB_MUTATION_AFTER_CROSSOVER,
					tfMutaAftCross.getText());
			properties.setProperty(PROB_PARAM_MUTATION, tfParamOnly.getText());
			properties.setProperty(PROB_GENE_MUTATION,
					tfSingleGenMuta.getText());
			properties.setProperty(PROB_RANDOM_PARAM_MUTATE,
					tfRandOrGauss.getText());
			properties.setProperty(PROB_CONNECTION_DISABLING,
					tfTempDisabled.getText());
			properties.setProperty(PARAM_MUTATION_GAUSSIAN_FACTOR1,
					tfGauss1.getText());
			properties.setProperty(PARAM_MUTATION_GAUSSIAN_FACTOR2,
					tfGauss2.getText());
			properties.setProperty(PROB_ADD_NODE_MUTATION, tfAddNode.getText());
			properties.setProperty(PROB_ADD_ACTIVATION,
					tfAddActivation.getText());
			properties.setProperty(PROB_ADD_DOUBLE_INHIBITION,
					tfAddDoubleInhibition.getText());
			properties.setProperty(SPECIATION_COEFFICIENT1, tfC1.getText());
			properties.setProperty(SPECIATION_COEFFICIENT2, tfC2.getText());
			properties.setProperty(SPECIATION_COEFFICIENT3, tfC3.getText());
			properties.setProperty(SPECIATION_THRESHOLD, tfSpeThres.getText());
			properties.setProperty(TARGET_NUMBER_OF_SPECIES,
					tfTargetNSpecies.getText());
			properties.setProperty(SPECIATION_THRESHOLD_MIN,
					tfMinSpeThres.getText());
			properties.setProperty(SPECIATION_THRESHOLD_MOD,
					tfSpeThresMod.getText());
			properties.setProperty(REMOVE_NON_IMPROVING_SPECIES,
					String.valueOf(cbRemoveNonImprovingSpecies.isSelected()));
			properties.setProperty(NUMBER_OF_NON_IMPROVING_SPECIES,
					tfNNonImproveGenerations.getText());
			properties.setProperty(AUTO_SPECIATION_THRESHOLD,
					String.valueOf(cbAutoSpeThres.isSelected()));
			properties.setProperty(SATURABLE_EXO,
					String.valueOf(cbExoSaturate.isSelected()));
			properties.setProperty(COUPLED_EXO,
					String.valueOf(cbExoCoupling.isSelected()));
			properties.setProperty(SATURABLE_POLY,
					String.valueOf(cbPolySaturate.isSelected()));
			properties.setProperty(COUPLED_POLY,
					String.valueOf(cbPolyCoupling.isSelected()));
			properties.setProperty(SATURABLE_NICK,
					String.valueOf(cbNickSaturate.isSelected()));
			properties.setProperty(COUPLED_NICK,
					String.valueOf(cbNickCoupling.isSelected()));
			properties.setProperty(EXO_SATURATION_FREE_TEMPLATES,
					String.valueOf(cbExoSaturateByFreeTemplates.isSelected()));
			properties.setProperty(EXO_SATURATION_TEMPLATES_ALL,
					String.valueOf(cbExoSaturationByTemplatesAll.isSelected()));
			properties.setProperty(KDUPLEX, tfKduplex.getText());
			properties.setProperty(NICKASE_ACTIVITY, tfNickAct.getText());
			properties.setProperty(POLY_ACTIVITY, tfPolyAct.getText());
			properties.setProperty(LEMBDA, tfLembda.getText());
			properties.setProperty(EXO, tfExoAct.getText());
			properties.setProperty(EXO_INHIB, tfExoInhib.getText());
			properties.setProperty(DISPLACE, tfDispl.getText());
			properties.setProperty(EXO_VM, tfExoVm.getText());
			properties.setProperty(EXO_KM_SIMPLE, tfExoKmSimple.getText());
			properties.setProperty(EXO_KM_INHIB, tfExoKmInhib.getText());
			properties.setProperty(EXO_KM_TEMPLATE, tfExoKmTemplate.getText());
			properties.setProperty(POL_KM, tfPolKm.getText());
			properties.setProperty(NICK_VM, tfNickVm.getText());
			properties.setProperty(LEAK_RATIO, tfLeakRatio.getText());
			properties.setProperty(TOEHOLD_LEFT, tfToeholdLeft.getText());
			properties.setProperty(TOEHOLD_RIGHT, tfToeholdRight.getText());
			properties.setProperty(POL_VM, tfPolVm.getText());
			properties.setProperty(POL_KM_BOTH, tfPolKmBoth.getText());
			properties.setProperty(NICK_KM, tfNickKm.getText());
			properties.setProperty(RATIO_INHIBITION, tfRatioInhib.getText());
			properties.setProperty(MAX_TIME, tfMaxTimeComplex.getText());
			properties.setProperty(NUMBER_OF_POINTS, tfNPoints.getText());
			properties.setProperty(MAX_TIME_SIMPLE, tfMaxTimeSimple.getText());
			properties.setProperty(INTER_ABS_ERROR,
					tfIntegrationAbsError.getText());
			properties.setProperty(INTER_REL_ERROR,
					tfIntegrationRelError.getText());
			properties.setProperty(THRESHOLD_STABILITY_DETECTION,
					tfThresholdStable.getText());
			properties.setProperty(MIN_TIME_STABLE, tfMinTimeStable.getText());
			properties.setProperty(MAX_INTEGRATION_STEPS,
					tfMaxIntegrationSteps.getText());

			properties.setProperty(TEMPLATE_OPTIMIZE,
					String.valueOf(cbOptTemplate.isSelected()));
			properties.setProperty(TEMPLATE_DEFAULT,
					tfTemplateDefault.getText());
			properties.setProperty(TEMPLATE_MIN, tfTemplateMin.getText());
			properties.setProperty(TEMPLATE_MAX, tfTemplateMax.getText());
			properties.setProperty(SEQK_OPTIMIZE,
					String.valueOf(cbOptSeqK.isSelected()));
			properties.setProperty(SEQK_DEFAULT, tfSeqKDefault.getText());
			properties.setProperty(SEQK_MIN, tfSeqKMin.getText());
			properties.setProperty(SEQK_MAX, tfSeqKMax.getText());
			properties.setProperty(INHK_OPTIMIZE,
					String.valueOf(cbOptInhK.getSelectedIndex()));
			properties.setProperty(INHK_DEFAULT, tfInhKDefault.getText());
			properties.setProperty(INHK_MIN, tfInhKMin.getText());
			properties.setProperty(INHK_MAX, tfInhKMax.getText());
			properties.setProperty(SEQC_OPTIMIZE,
					String.valueOf(cbOptSeqConc.isSelected()));
			properties.setProperty(SEQC_DEFAULT, tfSeqConcDefault.getText());
			properties.setProperty(SEQC_MIN, tfSeqConcMin.getText());
			properties.setProperty(SEQC_MAX, tfSeqConcMax.getText());
			properties.setProperty(EXOACT_OPTIMIZE,
					String.valueOf(cbOptExoAct.isSelected()));
			properties.setProperty(EXOACT_DEFAULT, tfExoActDefault.getText());
			properties.setProperty(EXOACT_MIN, tfExoActMin.getText());
			properties.setProperty(EXOACT_MAX, tfExoActMax.getText());
			properties.setProperty(EXOSIMPLEKM_OPTIMIZE,
					String.valueOf(cbOptExoSimpleKm.isSelected()));
			properties.setProperty(EXOSIMPLEKM_DEFAULT,
					tfExoSimpleKmDefault.getText());
			properties.setProperty(EXOSIMPLEKM_MIN, tfExoSimpleKmMin.getText());
			properties.setProperty(EXOSIMPLEKM_MAX, tfExoSimpleKmMax.getText());
			properties.setProperty(INHIBKM_OPTIMIZE,
					String.valueOf(cbOptInhibKm.isSelected()));
			properties.setProperty(INHIBKM_DEFAULT, tfInhibKmDefault.getText());
			properties.setProperty(INHIBKM_MIN, tfInhibKmMin.getText());
			properties.setProperty(INHIBKM_MAX, tfInhibKmMax.getText());
			properties.setProperty(POLACT_OPTIMIZE,
					String.valueOf(cbOptPolAct.isSelected()));
			properties.setProperty(POLACT_DEFAULT, tfPolActDefault.getText());
			properties.setProperty(POLACT_MIN, tfPolActMin.getText());
			properties.setProperty(POLACT_MAX, tfPolActMax.getText());
			properties.setProperty(POLKM_OPTIMIZE,
					String.valueOf(cbOptPolKm.isSelected()));
			properties.setProperty(POLKM_DEFAULT, tfPolKmDefault.getText());
			properties.setProperty(POLKM_MIN, tfPolKmMin.getText());
			properties.setProperty(POLKM_MAX, tfPolKmMax.getText());
			properties.setProperty(POL2STRANDKM_OPTIMIZE,
					String.valueOf(cbOptPol2StrandKm.isSelected()));
			properties.setProperty(POL2STRANDKM_DEFAULT,
					tfPol2StrandKmDefault.getText());
			properties.setProperty(POL2STRANDKM_MIN,
					tfPol2StrandKmMin.getText());
			properties.setProperty(POL2STRANDKM_MAX,
					tfPol2StrandKmMax.getText());
			properties.setProperty(NICKACT_OPTIMIZE,
					String.valueOf(cbOptNickAct.isSelected()));
			properties.setProperty(NICKACT_DEFAULT, tfNickActDefault.getText());
			properties.setProperty(NICKACT_MIN, tfNickActMin.getText());
			properties.setProperty(NICKACT_MAX, tfNickActMax.getText());
			properties.setProperty(NICKKM_OPTIMIZE,
					String.valueOf(cbOptNickKm.isSelected()));
			properties.setProperty(NICKKM_DEFAULT, tfNickKmDefault.getText());
			properties.setProperty(NICKKM_MIN, tfNickKmMin.getText());
			properties.setProperty(NICKKM_MAX, tfNickKmMax.getText());
			properties.store(fos, "");
			fos.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	private void loadFieldsFromFile(File file) {
		try {
			FileInputStream fis = new FileInputStream(file);
			Properties properties = new Properties();
			properties.load(fis);
			fis.close();
			tfNRuns.setText(properties.getProperty(NUMBER_OF_RUNS,
					tfNRuns.getText()));
			tfPopSize.setText(properties.getProperty(POP_SIZE,
					tfPopSize.getText()));
			tfMaxGen.setText(properties.getProperty(MAX_GENERATION,
					tfMaxGen.getText()));
			tfTourSize.setText(properties.getProperty(TOURNAMENT_SIZE,
					tfTourSize.getText()));
			tfMutaOnly.setText(properties.getProperty(PROB_MUTATION_ONLY,
					tfMutaOnly.getText()));
			tfInterspCross.setText(properties.getProperty(
					PROB_INTERSPECIES_MATING, tfInterspCross.getText()));
			tfMutaAftCross.setText(properties.getProperty(
					PROB_MUTATION_AFTER_CROSSOVER, tfMutaAftCross.getText()));
			tfParamOnly.setText(properties.getProperty(PROB_PARAM_MUTATION,
					tfParamOnly.getText()));
			tfSingleGenMuta.setText(properties.getProperty(PROB_GENE_MUTATION,
					tfSingleGenMuta.getText()));
			tfRandOrGauss.setText(properties.getProperty(
					PROB_RANDOM_PARAM_MUTATE, tfRandOrGauss.getText()));
			tfTempDisabled.setText(properties.getProperty(
					PROB_CONNECTION_DISABLING, tfTempDisabled.getText()));
			tfGauss1.setText(properties.getProperty(
					PARAM_MUTATION_GAUSSIAN_FACTOR1, tfGauss1.getText()));
			tfGauss2.setText(properties.getProperty(
					PARAM_MUTATION_GAUSSIAN_FACTOR2, tfGauss2.getText()));
			tfAddNode.setText(properties.getProperty(PROB_ADD_NODE_MUTATION,
					tfAddNode.getText()));
			tfAddActivation.setText(properties.getProperty(PROB_ADD_ACTIVATION,
					tfAddActivation.getText()));
			tfAddDoubleInhibition
					.setText(properties.getProperty(PROB_ADD_DOUBLE_INHIBITION,
							tfAddDoubleInhibition.getText()));
			tfC1.setText(properties.getProperty(SPECIATION_COEFFICIENT1,
					tfC1.getText()));
			tfC2.setText(properties.getProperty(SPECIATION_COEFFICIENT2,
					tfC2.getText()));
			tfC3.setText(properties.getProperty(SPECIATION_COEFFICIENT3,
					tfC3.getText()));
			tfSpeThres.setText(properties.getProperty(SPECIATION_THRESHOLD,
					tfSpeThres.getText()));
			tfTargetNSpecies.setText(properties.getProperty(
					TARGET_NUMBER_OF_SPECIES, tfTargetNSpecies.getText()));
			tfMinSpeThres.setText(properties.getProperty(
					SPECIATION_THRESHOLD_MIN, tfMinSpeThres.getText()));
			tfSpeThresMod.setText(properties.getProperty(
					SPECIATION_THRESHOLD_MOD, tfSpeThresMod.getText()));
			cbRemoveNonImprovingSpecies.setSelected(Boolean.valueOf(properties
					.getProperty(REMOVE_NON_IMPROVING_SPECIES)));
			tfNNonImproveGenerations.setText(properties
					.getProperty(NUMBER_OF_NON_IMPROVING_SPECIES));
			cbAutoSpeThres.setSelected(Boolean.valueOf(properties.getProperty(
					AUTO_SPECIATION_THRESHOLD,
					String.valueOf(cbAutoSpeThres.isSelected()))));
			cbExoSaturate
					.setSelected(Boolean.valueOf(properties.getProperty(
							SATURABLE_EXO,
							String.valueOf(cbExoSaturate.isSelected()))));
			cbExoCoupling.setSelected(Boolean.valueOf(properties.getProperty(
					COUPLED_EXO, String.valueOf(cbExoCoupling.isSelected()))));
			cbPolySaturate
					.setSelected(Boolean.valueOf(properties.getProperty(
							SATURABLE_POLY,
							String.valueOf(cbPolySaturate.isSelected()))));
			cbPolyCoupling
					.setSelected(Boolean.valueOf(properties.getProperty(
							COUPLED_POLY,
							String.valueOf(cbPolyCoupling.isSelected()))));
			cbNickSaturate
					.setSelected(Boolean.valueOf(properties.getProperty(
							SATURABLE_NICK,
							String.valueOf(cbNickSaturate.isSelected()))));
			cbNickCoupling
					.setSelected(Boolean.valueOf(properties.getProperty(
							COUPLED_NICK,
							String.valueOf(cbNickCoupling.isSelected()))));
			cbExoSaturateByFreeTemplates
					.setSelected(Boolean.valueOf(properties.getProperty(
							EXO_SATURATION_FREE_TEMPLATES, String
									.valueOf(cbExoSaturateByFreeTemplates
											.isSelected()))));
			cbExoSaturationByTemplatesAll.setSelected(Boolean
					.valueOf(properties.getProperty(
							EXO_SATURATION_TEMPLATES_ALL, String
									.valueOf(cbExoSaturationByTemplatesAll
											.isSelected()))));
			tfKduplex.setText(properties.getProperty(KDUPLEX,
					tfKduplex.getText()));
			tfNickAct.setText(properties.getProperty(NICKASE_ACTIVITY,
					tfNickAct.getText()));
			tfPolyAct.setText(properties.getProperty(POLY_ACTIVITY,
					tfPolyAct.getText()));
			tfLembda.setText(properties.getProperty(LEMBDA, tfLembda.getText()));
			tfExoAct.setText(properties.getProperty(EXO, tfExoAct.getText()));
			tfExoInhib.setText(properties.getProperty(EXO_INHIB,
					tfExoInhib.getText()));
			tfDispl.setText(properties.getProperty(DISPLACE, tfDispl.getText()));
			tfExoVm.setText(properties.getProperty(EXO_VM, tfExoVm.getText()));
			tfExoKmSimple.setText(properties.getProperty(EXO_KM_SIMPLE,
					tfExoKmSimple.getText()));
			tfExoKmInhib.setText(properties.getProperty(EXO_KM_INHIB,
					tfExoKmInhib.getText()));
			tfExoKmTemplate.setText(properties.getProperty(EXO_KM_TEMPLATE,
					tfExoKmTemplate.getText()));
			tfPolKm.setText(properties.getProperty(POL_KM, tfPolKm.getText()));
			tfNickVm.setText(properties.getProperty(NICK_VM, tfNickVm.getText()));
			tfLeakRatio.setText(properties.getProperty(LEAK_RATIO,
					tfLeakRatio.getText()));
			tfToeholdLeft.setText(properties.getProperty(TOEHOLD_LEFT,
					tfToeholdLeft.getText()));
			tfToeholdRight.setText(properties.getProperty(TOEHOLD_RIGHT,
					tfToeholdRight.getText()));
			tfPolVm.setText(properties.getProperty(POL_VM, tfPolVm.getText()));
			tfPolKmBoth.setText(properties.getProperty(POL_KM_BOTH,
					tfPolKmBoth.getText()));
			tfNickKm.setText(properties.getProperty(NICK_KM, tfNickKm.getText()));
			tfRatioInhib.setText(properties.getProperty(RATIO_INHIBITION,
					tfRatioInhib.getText()));
			tfMaxTimeComplex.setText(properties.getProperty(MAX_TIME,
					tfMaxTimeComplex.getText()));
			tfNPoints.setText(properties.getProperty(NUMBER_OF_POINTS,
					tfNPoints.getText()));
			tfMaxTimeSimple.setText(properties.getProperty(MAX_TIME_SIMPLE,
					tfMaxTimeSimple.getText()));
			tfIntegrationAbsError.setText(properties.getProperty(
					INTER_ABS_ERROR, tfIntegrationAbsError.getText()));
			tfIntegrationRelError.setText(properties.getProperty(
					INTER_REL_ERROR, tfIntegrationRelError.getText()));
			tfThresholdStable
					.setText(properties.getProperty(
							THRESHOLD_STABILITY_DETECTION,
							tfThresholdStable.getText()));
			tfMinTimeStable.setText(properties.getProperty(MIN_TIME_STABLE,
					tfMinTimeStable.getText()));
			tfMaxIntegrationSteps.setText(properties.getProperty(
					MAX_INTEGRATION_STEPS, tfMaxIntegrationSteps.getText()));
			cbOptTemplate.setSelected(Boolean.valueOf(properties.getProperty(
					TEMPLATE_OPTIMIZE,
					String.valueOf(cbOptTemplate.isSelected()))));
			tfTemplateDefault.setText(properties.getProperty(TEMPLATE_DEFAULT,
					tfTemplateDefault.getText()));
			tfTemplateMin.setText(properties.getProperty(TEMPLATE_MIN,
					tfTemplateMin.getText()));
			tfTemplateMax.setText(properties.getProperty(TEMPLATE_MAX,
					tfTemplateMax.getText()));
			cbOptSeqK.setSelected(Boolean.valueOf(properties.getProperty(
					SEQK_OPTIMIZE, String.valueOf(cbOptSeqK.isSelected()))));
			tfSeqKDefault.setText(properties.getProperty(SEQK_DEFAULT,
					tfSeqKDefault.getText()));
			tfSeqKMin.setText(properties.getProperty(SEQK_MIN,
					tfSeqKMin.getText()));
			tfSeqKMax.setText(properties.getProperty(SEQK_MAX,
					tfSeqKMax.getText()));
			cbOptInhK
					.setSelectedIndex(Integer.valueOf(properties.getProperty(
							INHK_OPTIMIZE,
							String.valueOf(cbOptInhK.getSelectedIndex()))));
			tfInhKDefault.setText(properties.getProperty(INHK_DEFAULT,
					tfInhKDefault.getText()));
			tfInhKMin.setText(properties.getProperty(INHK_MIN,
					tfInhKMin.getText()));
			tfInhKMax.setText(properties.getProperty(INHK_MAX,
					tfInhKMax.getText()));
			cbOptSeqConc.setSelected(Boolean.valueOf(properties.getProperty(
					SEQC_OPTIMIZE, String.valueOf(cbOptSeqConc.isSelected()))));
			tfSeqConcDefault.setText(properties.getProperty(SEQC_DEFAULT,
					tfSeqConcDefault.getText()));
			tfSeqConcMin.setText(properties.getProperty(SEQC_MIN,
					tfSeqConcMin.getText()));
			tfSeqConcMax.setText(properties.getProperty(SEQC_MAX,
					tfSeqConcMax.getText()));
			cbOptExoAct
					.setSelected(Boolean.valueOf(properties.getProperty(
							EXOACT_OPTIMIZE,
							String.valueOf(cbOptExoAct.isSelected()))));
			tfExoActDefault.setText(properties.getProperty(EXOACT_DEFAULT,
					tfExoActDefault.getText()));
			tfExoActMin.setText(properties.getProperty(EXOACT_MIN,
					tfExoActMin.getText()));
			tfExoActMax.setText(properties.getProperty(EXOACT_MAX,
					tfExoActMax.getText()));
			cbOptExoSimpleKm.setSelected(Boolean.valueOf(properties
					.getProperty(EXOSIMPLEKM_OPTIMIZE,
							String.valueOf(cbOptExoSimpleKm.isSelected()))));
			tfExoSimpleKmDefault.setText(properties.getProperty(
					EXOSIMPLEKM_DEFAULT, tfExoSimpleKmDefault.getText()));
			tfExoSimpleKmMin.setText(properties.getProperty(EXOSIMPLEKM_MIN,
					tfExoSimpleKmMin.getText()));
			tfExoSimpleKmMax.setText(properties.getProperty(EXOSIMPLEKM_MAX,
					tfExoSimpleKmMax.getText()));
			cbOptInhibKm
					.setSelected(Boolean.valueOf(properties.getProperty(
							INHIBKM_OPTIMIZE,
							String.valueOf(cbOptInhibKm.isSelected()))));
			tfInhibKmDefault.setText(properties.getProperty(INHIBKM_DEFAULT,
					tfInhibKmDefault.getText()));
			tfInhibKmMin.setText(properties.getProperty(INHIBKM_MIN,
					tfInhibKmMin.getText()));
			tfInhibKmMax.setText(properties.getProperty(INHIBKM_MAX,
					tfInhibKmMax.getText()));
			cbOptPolAct
					.setSelected(Boolean.valueOf(properties.getProperty(
							POLACT_OPTIMIZE,
							String.valueOf(cbOptPolAct.isSelected()))));
			tfPolActDefault.setText(properties.getProperty(POLACT_DEFAULT,
					tfPolActDefault.getText()));
			tfPolActMin.setText(properties.getProperty(POLACT_MIN,
					tfPolActMin.getText()));
			tfPolActMax.setText(properties.getProperty(POLACT_MAX,
					tfPolActMax.getText()));
			cbOptPolKm.setSelected(Boolean.valueOf(properties.getProperty(
					POLKM_OPTIMIZE, String.valueOf(cbOptPolKm.isSelected()))));
			tfPolKmDefault.setText(properties.getProperty(POLKM_DEFAULT,
					tfPolKmDefault.getText()));
			tfPolKmMin.setText(properties.getProperty(POLKM_MIN,
					tfPolKmMin.getText()));
			tfPolKmMax.setText(properties.getProperty(POLKM_MAX,
					tfPolKmMax.getText()));
			cbOptPol2StrandKm.setSelected(Boolean.valueOf(properties
					.getProperty(POL2STRANDKM_OPTIMIZE,
							String.valueOf(cbOptPol2StrandKm.isSelected()))));
			tfPol2StrandKmDefault.setText(properties.getProperty(
					POL2STRANDKM_DEFAULT, tfPol2StrandKmDefault.getText()));
			tfPol2StrandKmMin.setText(properties.getProperty(POL2STRANDKM_MIN,
					tfPol2StrandKmMin.getText()));
			tfPol2StrandKmMax.setText(properties.getProperty(POL2STRANDKM_MAX,
					tfPol2StrandKmMax.getText()));
			cbOptNickAct
					.setSelected(Boolean.valueOf(properties.getProperty(
							NICKACT_OPTIMIZE,
							String.valueOf(cbOptNickAct.isSelected()))));
			tfNickActDefault.setText(properties.getProperty(NICKACT_DEFAULT,
					tfNickActDefault.getText()));
			tfNickActMin.setText(properties.getProperty(NICKACT_MIN,
					tfNickActMin.getText()));
			tfNickActMax.setText(properties.getProperty(NICKACT_MAX,
					tfNickActMax.getText()));
			cbOptNickKm
					.setSelected(Boolean.valueOf(properties.getProperty(
							NICKKM_OPTIMIZE,
							String.valueOf(cbOptNickKm.isSelected()))));
			tfNickKmDefault.setText(properties.getProperty(NICKKM_DEFAULT,
					tfNickKmDefault.getText()));
			tfNickKmMin.setText(properties.getProperty(NICKKM_MIN,
					tfNickKmMin.getText()));
			tfNickKmMax.setText(properties.getProperty(NICKKM_MAX,
					tfNickKmMax.getText()));

			updateSlider(slAddActivation, tfAddActivation);
			updateSlider(slAddDoubleInhibition, tfAddDoubleInhibition);
			updateSlider(slAddNode, tfAddNode);
			updateSlider(slInterspCross, tfInterspCross);
			updateSlider(slMutaAftCross, tfMutaAftCross);
			updateSlider(slMutaOnly, tfMutaOnly);
			updateSlider(slParamOnly, tfParamOnly);
			updateSlider(slRandOrGauss, tfRandOrGauss);
			updateSlider(slSingleGenMuta, tfSingleGenMuta);
			updateSlider(slTempDisabled, tfTempDisabled);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class MyChangeListener implements ChangeListener {

		private JTextField textField;

		public MyChangeListener(JTextField textField) {
			this.textField = textField;
		}

		@Override
		public void stateChanged(ChangeEvent e) {
			JSlider source = (JSlider) e.getSource();
			// if (!source.getValueIsAdjusting()) {
			int i = (int) source.getValue();
			double tmp = (double) i / 100;
			this.textField.setText(common.Static.df2.format(tmp));
			if (source == slParamOnly) {
				slStructure.setValue(100 - i);
			}
			if (source == slStructure) {
				slParamOnly.setValue(100 - i);
			}
			if (source == slMutaOnly) {
				slCrossover.setValue(100 - i);
			}
			if (source == slCrossover) {
				slMutaOnly.setValue(100 - i);
			}
			if (source == slInterspCross) {
				slIntraspCross.setValue(100 - i);
			}
			if (source == slIntraspCross) {
				slInterspCross.setValue(100 - i);
			}
			if (source == slAddActivation || source == slAddNode
					|| source == slAddDoubleInhibition) {
				i = Math.max(0,
						100 - slAddActivation.getValue() - slAddNode.getValue()
								- slAddDoubleInhibition.getValue());
				tmp = (double) i / 100;
				slAddSingleInhibition.setValue(i);
			}

			// }
		}
	}

	class MyFocusListener implements FocusListener {
		private JSlider slider;

		public MyFocusListener() {
			this.slider = null;
		}

		public MyFocusListener(JSlider slider) {
			this.slider = slider;
		}

		@Override
		public void focusGained(FocusEvent arg0) {

		}

		@Override
		public void focusLost(FocusEvent arg0) {
			JTextField textField = (JTextField) arg0.getSource();
			int i = (int) Math.round(100 * Double.parseDouble(textField
					.getText()));
			slider.setValue(i);
		}
	}

	class IntInputVerifier extends InputVerifier {
		@Override
		public boolean verify(JComponent input) {
			String text = ((JTextField) input).getText();
			try {
				Integer.parseInt(text);
			} catch (NumberFormatException e) {
				return false;
			}
			return true;
		}
	}

	class DoubleInputVerifier extends InputVerifier {
		@Override
		public boolean verify(JComponent input) {
			String text = ((JTextField) input).getText();
			try {
				Double.parseDouble(text);
			} catch (NumberFormatException e) {
				return false;
			}
			return true;
		}
	}

	class ProbInputVerifier extends InputVerifier {
		@Override
		public boolean verify(JComponent input) {
			String text = ((JTextField) input).getText();
			double x = -1;
			try {
				x = Double.parseDouble(text);
			} catch (NumberFormatException e) {
				return false;
			}
			if (x < 0 || x > 1) {
				return false;
			} else {
				return true;
			}
		}

	}
}
